WindowFactory object ownership and cleanup issues

Create issue
Issue #249 resolved
Paul Turner created an issue

Due to the fact CEGUI::WindowFactoryManager does not take ownership of WindowFactory objects registered with it, there is a real potential for issues and exceptions being thrown because client code may destroy or otherwise remove the WindowFactory before CEGUI is done with it (i.e. Window objects still exist that require the factory to be present for final object deletion).

Probable best solution is to allow CEGUI to take ownership of WindowFactory objects. While there are various solutions to taking ownership of subclassed WindowFactory objects from a base class WindowFactory ptr/ref, a template based approach is very favourable here.

Reproducibility: have not tried

Additional information: See original report and discussion here: http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3661

Comments (1)

  1. Paul Turner reporter

    added a templatised addFactory member function, so now you can do:

    CEGUI::WindowFactoryManager::getSingleton().addFactory<MyNewWidgetFactory>();

    this will create the factory and then add it to the system. When the factory gets removed - either directly or at system destruction - the factory object will be deleted by the system.

    Currently in branches/v0-6 at rev 1854

  2. Log in to comment