Page 1 of 1

A event error

Posted: Thu Apr 27, 2006 03:39
by PeakGao
Hi,
I find a error in System class about event. in the System::constructor_impl:

Code: Select all

d_renderer->subscribeEvent(Renderer::EventDisplaySizeChanged, Event::Subscriber(&CEGUI::System::handleDisplaySizeChange, this));


when i do the code below:

Code: Select all

Renderer* myRenderer = new OpenGLRenderer;
new System(myRenderer,...,"login.config")
// ...
delete System::getSingetonPtr();
new System(myRenderer,...,"actorSelect.config");


so, Renderer has connected two subscriber, one subscriber come from the System class that had been deleted. anothor come from the last System class. When window size changed, a exception will raise!

so, in the System::~System(), should cancel the subscriber, it is a pity that EventSet does not support unsubscribe method. Event support unsubscibe method, but EventSet doesn't support getEvent(String) method (suggest that add getEvent method).

now, i only can do it by

Code: Select all

Renderer* myRenderer = new OpenGLRenderer;
new System(myRenderer,...,"login.config")
// ...
delete System::getSingetonPtr();

myRenderer->removeEvent(Renderer::EventDisplaySizeChanged);
myRenderer->addEvent(Renderer::EventDisplaySizeChanged);

new System(myRenderer,...,"actorSelect.config");


Posted: Thu Apr 27, 2006 14:57
by lindquist
Thanx again for the bug report :)
You are proving quite the valuable tester.

I'll add a ticket for now, and hopefully by the weekend I should be able to fix this.

Thanx

Posted: Tue May 09, 2006 22:13
by lindquist
This is now fixed for both 0.4 and 0.5