Access violation (bad reference counting, irrlicht)

Started by
12 comments, last by Khatharr 10 years, 11 months ago

The class is part of the engine and its here:

http://irrlicht.sourceforge.net/docu/classirr_1_1gui_1_1_i_g_u_i_static_text.html

But i create something every time i run my writeWrap function no? Then i have to also remove it or it will remain somewhere in the void isnt that so?
Erik

Advertisement

Hm... There's only a default destructor, so that rules that out. So, it may be a red herring to be trying to find fault in this reference counting; judging by the error given, it's crashing when trying to read ReferenceCounter, rather than triggering the assertion. So, it's either someone obviously is trying to use the automatically freed resource, or is trying to access something that was freed through some other means.

A stack trace and full error output would be desired. However, is it possible for you to place debug printing functions that don't depend on any state tracked by your code (like using std::cerr or std::wcerr), and have it output something like "IGUIStaticText constructed at (memory address)" on construction and reference increments, and "IGUIStaticText dropped at (memory address)" on calls to drop()? The (memory address) placeholder would be the value held by the this pointer, and if it doesn't dereference the this pointer for local variables or a vtable, it may manage to output the data without crashing, though the erroneous one would be undefined behavior, but it may still work for your platform.

If all goes to plan, you can count the number of times that a message is output for incrementing, and the number of times that a message is output for decrementing. If the two messages are equal in volume, we're barking up the wrong tree.

Looking over Gebhardt's tuts it looks like the static text object is subordinate to an environment object, or should be. Seems you're only supposed to instantiate it once and then just render the environment and let everything auto-deallocate via spooky action from a distance. I've only got the phone until tomorrow, but I'll try to take a closer look when I can get to a computer. At first glance, though, it looks exactly like the nonsense from irrklang.
void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

Yeah. This is the same thing.

http://irrlicht.sourceforge.net/docu/classirr_1_1gui_1_1_i_g_u_i_environment.html#adb56652b23932a391b08f710a9546ef3

You're supposed to create the device, fetch the environment from it and then add your GUI widgets, then just call the environment's drawAll() each frame until you're done and then just drop the device to free everything. You gotta keep an eye on this cat. He makes everything droppable and then just mentions in his docs that there's all sorts of things that you shouldn't drop.

Here's his GUI tut:

http://irrlicht.sourceforge.net/docu/example005.html

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

This topic is closed to new replies.

Advertisement