Hello,
I've been noticing in EVERY project that I've made in Irrlicht, when it gets big enough, it always crashes on device->drop()...
So I'm wondering what could cause this and how to get around it.
NO, it is NOT in a loop. NO, I am NOT dropping it twice. YES, it is global.
Thanks
________
Cancer - breast forums
Device cleanup crash.
Device cleanup crash.
Last edited by disanti on Sun Feb 27, 2011 11:11 pm, edited 1 time in total.
Heheheh, great fun! ^_^
This ought to take a while... lets see, 36 source files with about 15,000 lines of code.
Question: Is it ok to drop loaded IGUIFonts? I can't think of any other way to destroy them as the IGUIEnvironment doesn't manage them.
________
LOLOL
This ought to take a while... lets see, 36 source files with about 15,000 lines of code.
Question: Is it ok to drop loaded IGUIFonts? I can't think of any other way to destroy them as the IGUIEnvironment doesn't manage them.
________
LOLOL
Last edited by disanti on Sun Feb 27, 2011 11:11 pm, edited 1 time in total.
Taken from IGUIEnvironment.h...
The IGUIEnvironment doesn't provide an interface for managing the fonts, only getting/loading them. You could always modify the IGUIEnvironment interface to allow removing a font from the cache...
and implement those methods in the derived CGUIEnvironment...
Travis
Code: Select all
//! Returns pointer to the font with the specified file name.
/** Loads the font if it was not loaded before. Returns 0 if the font could not be loaded.
\return
returns a pointer to the font.
This pointer should not be dropped. See IUnknown::drop() for more information. */
virtual IGUIFont* getFont(const c8* filename) = 0;
Code: Select all
virtual IGUIFont* findFont(const c8* filename) = 0;
virtual void removeFont(IGUIFont* font) = 0;
Code: Select all
IGUIFont* CGUIEnvironment::findFont(const c8* filename)
{
if (!filename)
filename = "";
f.Filename = filename;
f.Filename.make_lower();
s32 index = Fonts.binary_search(f);
if (index != -1)
return Fonts[index].Font;
return 0;
}
void CGUIEnvironment::removeFont(IGUIFont* font)
{
// could use Fonts.linear_search, but need to define
// SFont::operator== to compare font pointer and
// need to fix bug in array linear_search.. it should use op== not op<
for (irr::u32 i = 0; i < Fonts.size(); ++i)
{
if (Fonts[i].Font == font)
{
Fonts.erase(i);
font->drop();
return;
}
}
}
OK, I removed all font->drop()s and it prevented the crash for a whole day! I didn't even touch the code, and it crashes again (this time 12 crash dialogs in a row! XD)
It ALWAYS crashes on device->drop() according to my debugger... Any ideas?
________
New Jersey Medical Marijuana
It ALWAYS crashes on device->drop() according to my debugger... Any ideas?
________
New Jersey Medical Marijuana
Last edited by disanti on Sun Feb 27, 2011 11:11 pm, edited 1 time in total.
OK, after some more debugging, inside of the drop function, I know the following information:
ReferenceCount = -17891602
DebugName = 0xBAADF00D
So I can't even figure out what is crashing it!
________
RAMBLER AMERICAN HISTORY
ReferenceCount = -17891602
DebugName = 0xBAADF00D
So I can't even figure out what is crashing it!
________
RAMBLER AMERICAN HISTORY
Last edited by disanti on Sun Feb 27, 2011 11:11 pm, edited 1 time in total.
AND now I seemed to figure it out.. I was being an idiot somewhere in my code by placing an ISceneNode*->drop() instead of ISceneNode*->remove(). WTF was I thinking?! XD
________
HALF-BAKED
________
HALF-BAKED
Last edited by disanti on Sun Feb 27, 2011 11:11 pm, edited 1 time in total.