problems with dropping device

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
-insane-
Posts: 18
Joined: Tue Aug 04, 2009 4:41 pm
Location: Germany

problems with dropping device

Post by -insane- »

Code: Select all

	IrrlichtDevice* device = createDevice (EDT_NULL); 

	IFileSystem* file = NULL;

	IGUIEnvironment *environment = device->getGUIEnvironment();
	file = environment->getFileSystem(); 
	environment->drop();
	device->drop();
Here i got an access violation. If i want to drop a normal device (EDT_DIRECT3D9 or something like that) i get the same problem. I'm using Irrlicht 1.5.

Code: Select all

	// Irrlicht code
	bool drop() const
	{
		// someone is doing bad reference counting.
		_IRR_DEBUG_BREAK_IF(ReferenceCounter <= 0)

		--ReferenceCounter; // ReferenceCounter = 1
		if (!ReferenceCounter)
		{
			delete this; // access violation
			return true;
		}

		return false;
	}
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Why are you dropping the environment? Try not doing that ;)

Read up on the docs for (i think) IUnknown and you'll learn a bit about what should and shouldn't be dropped.
Image Image Image
-insane-
Posts: 18
Joined: Tue Aug 04, 2009 4:41 pm
Location: Germany

Post by -insane- »

Hehe okay thx, that was it :D
Post Reply