PAL12486: SIGSEGV when closing a study. Check value, returned by application() method.

This commit is contained in:
jfa 2006-06-01 10:41:49 +00:00
parent 38c7af7b96
commit cdaa3d7f3c

View File

@ -340,7 +340,9 @@ void GeometryGUI::OnGUIEvent()
//======================================================================= //=======================================================================
void GeometryGUI::OnGUIEvent( int id ) 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 // check type of the active viewframe
SUIT_ViewWindow* window = desk->activeWindow(); SUIT_ViewWindow* window = desk->activeWindow();
@ -561,8 +563,11 @@ void GeometryGUI::OnKeyPress( SUIT_ViewWindow* win, QKeyEvent* pe )
{ {
GUIMap::Iterator it; GUIMap::Iterator it;
bool bOk = true; bool bOk = true;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) {
bOk = bOk && it.data()->OnKeyPress( pe, application()->desktop(), win ); SUIT_Application* anApp = application();
if (!anApp) return;
bOk = bOk && it.data()->OnKeyPress( pe, anApp->desktop(), win );
}
// return bOk; // return bOk;
} }
@ -575,8 +580,11 @@ void GeometryGUI::OnMouseMove( SUIT_ViewWindow* win, QMouseEvent* pe )
{ {
GUIMap::Iterator it; GUIMap::Iterator it;
bool bOk = true; bool bOk = true;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) {
bOk = bOk && it.data()->OnMouseMove( pe, application()->desktop(), win ); SUIT_Application* anApp = application();
if (!anApp) return;
bOk = bOk && it.data()->OnMouseMove( pe, anApp->desktop(), win );
}
// return bOk; // 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 // OnMousePress() should return false if this event should be processed further
// (see OCCViewer_Viewer3d::onMousePress() for explanation) // (see OCCViewer_Viewer3d::onMousePress() for explanation)
bool processed = false; bool processed = false;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it ) {
processed = processed || it.data()->OnMousePress( pe, application()->desktop(), win ); SUIT_Application* anApp = application();
if (!anApp) return;
processed = processed || it.data()->OnMousePress( pe, anApp->desktop(), win );
}
// return processed; // return processed;
} }