Fix another GL crash at shutdown

This commit is contained in:
rdb 2015-11-11 17:06:32 +01:00
parent 90f05d7284
commit f9add18798
3 changed files with 9 additions and 18 deletions

View File

@ -3008,15 +3008,8 @@ close_gsg() {
// will be responsible for cleaning up anything we don't clean up // will be responsible for cleaning up anything we don't clean up
// explicitly. We'll just let them drop. // explicitly. We'll just let them drop.
// However, if any objects have recently been released, we have to // Make sure that all the contexts belonging to the GSG are deleted.
// ensure they are actually deleted properly. _prepared_objects.clear();
Thread *current_thread = Thread::get_current_thread();
_prepared_objects->begin_frame(this, current_thread);
_prepared_objects->end_frame(current_thread);
// We have to clear the list of timer queries, though, otherwise
// their destructors will cause a crash when they try to access
// the GSG object.
#ifdef DO_PSTATS #ifdef DO_PSTATS
_pending_timer_queries.clear(); _pending_timer_queries.clear();
#endif #endif

View File

@ -4689,6 +4689,13 @@ void CLP(GraphicsStateGuardian)::
release_texture(TextureContext *tc) { release_texture(TextureContext *tc) {
CLP(TextureContext) *gtc = DCAST(CLP(TextureContext), tc); CLP(TextureContext) *gtc = DCAST(CLP(TextureContext), tc);
#ifndef OPENGLES
_textures_needing_fetch_barrier.erase(gtc);
_textures_needing_image_access_barrier.erase(gtc);
_textures_needing_update_barrier.erase(gtc);
_textures_needing_framebuffer_barrier.erase(gtc);
#endif
glDeleteTextures(1, &gtc->_index); glDeleteTextures(1, &gtc->_index);
if (gtc->_buffer != 0) { if (gtc->_buffer != 0) {

View File

@ -23,15 +23,6 @@ TypeHandle CLP(TextureContext)::_type_handle;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
CLP(TextureContext):: CLP(TextureContext)::
~CLP(TextureContext)() { ~CLP(TextureContext)() {
#ifndef OPENGLES
if (gl_enable_memory_barriers) {
_glgsg->_textures_needing_fetch_barrier.erase(this);
_glgsg->_textures_needing_image_access_barrier.erase(this);
_glgsg->_textures_needing_update_barrier.erase(this);
_glgsg->_textures_needing_framebuffer_barrier.erase(this);
}
#endif
// Don't call glDeleteTextures; we may not have an active context. // Don't call glDeleteTextures; we may not have an active context.
} }