123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|406|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> C/C++/C#/Other -> Strange OpenGL Segfault

Sat, 02 Jul 2011, 13:54
shroom_monk
Ok, so I'm working on some image management code in C++ with SFML, but I'm getting a strange segmentation fault that isn't a massive problem, but I want to know what's causing it.

If I let the program run and close itself properly, all is fine. However, if I close the console window instead (i.e. a sort of emergency terminate), then I get a segfault in glDeleteTextures(), which is called by the destructor sf::Image::~Image() (this is the SFML library's image class).

I'm assuming this is because some stuff is getting deleted from memory in the wrong order when the program is terminated in this way, but I can't figure out why, particularly since it all clears up fine when the program is allowed to terminate normally.

Anyone know much about how C++ handles this sort of thing, and why this is happening? Thanks.

|edit| Did a bit of Googling... someone else had the same problem here: www.sfml-dev.org/forum/viewtopic.php?t=3955
I'm assuming that since this error can only be produced by force terminating the console window, which won't be about in the final version, I can just ignore this error for now? |edit|


-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Sat, 02 Jul 2011, 15:39
Cower
Best guess is the context was killed before you attempted to delete a texture, but it's really nearly impossible to debug OpenGL stuff. Might want to try using gDebugger, though.