From cdaa3d7f3cc1efed37275963908bbb32db5d0f50 Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 1 Jun 2006 10:41:49 +0000 Subject: [PATCH] PAL12486: SIGSEGV when closing a study. Check value, returned by application() method. --- src/GEOMGUI/GeometryGUI.cxx | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index d6a87e259..a3d1796f0 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -340,7 +340,9 @@ void GeometryGUI::OnGUIEvent() //======================================================================= void GeometryGUI::OnGUIEvent( int id ) { - SUIT_Desktop* desk = application()->desktop(); + SUIT_Application* anApp = application(); + if (!anApp) return; + SUIT_Desktop* desk = anApp->desktop(); // check type of the active viewframe SUIT_ViewWindow* window = desk->activeWindow(); @@ -561,8 +563,11 @@ void GeometryGUI::OnKeyPress( SUIT_ViewWindow* win, QKeyEvent* pe ) { GUIMap::Iterator it; bool bOk = true; - for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) - bOk = bOk && it.data()->OnKeyPress( pe, application()->desktop(), win ); + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) { + SUIT_Application* anApp = application(); + if (!anApp) return; + bOk = bOk && it.data()->OnKeyPress( pe, anApp->desktop(), win ); + } // return bOk; } @@ -575,8 +580,11 @@ void GeometryGUI::OnMouseMove( SUIT_ViewWindow* win, QMouseEvent* pe ) { GUIMap::Iterator it; bool bOk = true; - for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) - bOk = bOk && it.data()->OnMouseMove( pe, application()->desktop(), win ); + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) { + SUIT_Application* anApp = application(); + if (!anApp) return; + bOk = bOk && it.data()->OnMouseMove( pe, anApp->desktop(), win ); + } // return bOk; } @@ -591,8 +599,11 @@ void GeometryGUI::OnMousePress( SUIT_ViewWindow* win, QMouseEvent* pe ) // OnMousePress() should return false if this event should be processed further // (see OCCViewer_Viewer3d::onMousePress() for explanation) bool processed = false; - for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) - processed = processed || it.data()->OnMousePress( pe, application()->desktop(), win ); + for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) { + SUIT_Application* anApp = application(); + if (!anApp) return; + processed = processed || it.data()->OnMousePress( pe, anApp->desktop(), win ); + } // return processed; } -- 2.39.2