61
General / Possible Bug in RenderWindow Destructor (SFML 2.0)
« on: October 13, 2011, 11:21:37 pm »
Okay, I'll bite
Again, this is all based on my very limited knowledge of SFML's internals:
1) Create a sf::GraphicsInitialize object which must be constructed as an automatic object (disable operator new/delete to enforce this) some time after main() has been entered. sf::GraphicsInitialize would be responsible for the creation and destruction of both the shared context and the default font (and whatever else is needed).
2) Remove any context creation/destruction code from GlResource.
3) Allow EnsureContext() to fail if called outside the lifetime of the sf::GraphicsInitialize object.
4) Resources treat 'EnsureContext()' like any other possibly failing function (e.g. assert, throw, return false, whatever), except from destructors, where failure to EnsureContext() implies that nothing need be done (i.e. no context implies no resource to destroy).
What do you think?
Again, this is all based on my very limited knowledge of SFML's internals:
1) Create a sf::GraphicsInitialize object which must be constructed as an automatic object (disable operator new/delete to enforce this) some time after main() has been entered. sf::GraphicsInitialize would be responsible for the creation and destruction of both the shared context and the default font (and whatever else is needed).
2) Remove any context creation/destruction code from GlResource.
3) Allow EnsureContext() to fail if called outside the lifetime of the sf::GraphicsInitialize object.
4) Resources treat 'EnsureContext()' like any other possibly failing function (e.g. assert, throw, return false, whatever), except from destructors, where failure to EnsureContext() implies that nothing need be done (i.e. no context implies no resource to destroy).
What do you think?