From b62e6d0eeb798d1b9302ad40e9f80c6079893d6a Mon Sep 17 00:00:00 2001 From: codereader Date: Mon, 2 Jan 2017 12:38:21 +0100 Subject: [PATCH] Fix #4459: Rare crash when opening Texture Tool Due to stale references of previously selected objects --- radiant/textool/TexTool.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/radiant/textool/TexTool.cpp b/radiant/textool/TexTool.cpp index b8f2dd9912..40827d70db 100644 --- a/radiant/textool/TexTool.cpp +++ b/radiant/textool/TexTool.cpp @@ -129,6 +129,10 @@ void TexTool::_preHide() GlobalUndoSystem().removeObserver(this); GlobalSelectionSystem().removeObserver(this); + + // Clear items to prevent us from running into stale references + // when the textool is shown again + _items.clear(); } // Pre-show callback @@ -716,6 +720,11 @@ void TexTool::drawGrid() { void TexTool::onGLDraw() { + if (_updateNeeded) + { + return; // stop here, wait for the next idle event to refresh + } + // Initialise the viewport glViewport(0, 0, _windowDims[0], _windowDims[1]); glMatrixMode(GL_PROJECTION);