mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7778 Check for valid pointer to main window before use
This commit is contained in:
parent
886f5e3295
commit
ccfc0e25bc
@ -299,7 +299,7 @@ void RiaGuiApplication::storeTreeViewState()
|
||||
QStringList treeStates;
|
||||
QStringList treeIndexes;
|
||||
|
||||
for ( auto& tv : mainWindow()->projectTreeViews() )
|
||||
for ( auto& tv : m_mainWindow->projectTreeViews() )
|
||||
{
|
||||
QString treeViewState;
|
||||
tv->storeTreeViewStateToString( treeViewState );
|
||||
@ -1291,12 +1291,8 @@ void RiaGuiApplication::onProjectBeingClosed()
|
||||
|
||||
RiaGuiApplication::clearAllSelections();
|
||||
|
||||
m_mainWindow->cleanupGuiBeforeProjectClose();
|
||||
|
||||
if ( m_mainPlotWindow )
|
||||
{
|
||||
m_mainPlotWindow->cleanupGuiBeforeProjectClose();
|
||||
}
|
||||
if ( m_mainWindow ) m_mainWindow->cleanupGuiBeforeProjectClose();
|
||||
if ( m_mainPlotWindow ) m_mainPlotWindow->cleanupGuiBeforeProjectClose();
|
||||
|
||||
caf::EffectGenerator::clearEffectCache();
|
||||
}
|
||||
@ -1306,14 +1302,8 @@ void RiaGuiApplication::onProjectBeingClosed()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGuiApplication::onProjectClosed()
|
||||
{
|
||||
if ( m_mainWindow )
|
||||
{
|
||||
m_mainWindow->initializeGuiNewProjectLoaded();
|
||||
}
|
||||
if ( m_mainPlotWindow )
|
||||
{
|
||||
m_mainPlotWindow->initializeGuiNewProjectLoaded();
|
||||
}
|
||||
if ( m_mainWindow ) m_mainWindow->initializeGuiNewProjectLoaded();
|
||||
if ( m_mainPlotWindow ) m_mainPlotWindow->initializeGuiNewProjectLoaded();
|
||||
|
||||
setWindowCaptionFromAppState();
|
||||
|
||||
@ -1364,16 +1354,16 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences*
|
||||
|
||||
if ( m_mainWindow )
|
||||
{
|
||||
for ( auto& tv : mainWindow()->projectTreeViews() )
|
||||
for ( auto& tv : m_mainWindow->projectTreeViews() )
|
||||
{
|
||||
tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() );
|
||||
}
|
||||
if ( mainPlotWindow() )
|
||||
}
|
||||
if ( mainPlotWindow() )
|
||||
{
|
||||
for ( auto& tv : mainPlotWindow()->projectTreeViews() )
|
||||
{
|
||||
for ( auto& tv : mainPlotWindow()->projectTreeViews() )
|
||||
{
|
||||
tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() );
|
||||
}
|
||||
tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1561,6 +1551,7 @@ int RiaGuiApplication::applicationResolution()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGuiApplication::startMonitoringWorkProgress( caf::UiProcess* uiProcess )
|
||||
{
|
||||
CAF_ASSERT( m_mainWindow );
|
||||
m_mainWindow->processMonitor()->startMonitorWorkProcess( uiProcess );
|
||||
}
|
||||
|
||||
@ -1569,6 +1560,7 @@ void RiaGuiApplication::startMonitoringWorkProgress( caf::UiProcess* uiProcess )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGuiApplication::stopMonitoringWorkProgress()
|
||||
{
|
||||
CAF_ASSERT( m_mainWindow );
|
||||
m_mainWindow->processMonitor()->stopMonitorWorkProcess();
|
||||
}
|
||||
|
||||
@ -1577,6 +1569,8 @@ void RiaGuiApplication::stopMonitoringWorkProgress()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaGuiApplication::slotWorkerProcessFinished( int exitCode, QProcess::ExitStatus exitStatus )
|
||||
{
|
||||
CAF_ASSERT( m_mainWindow );
|
||||
|
||||
m_mainWindow->processMonitor()->stopMonitorWorkProcess();
|
||||
|
||||
QProcessEnvironment processEnvironment = m_workerProcess->processEnvironment();
|
||||
|
@ -61,7 +61,10 @@ void RicExitApplicationFeature::onActionTriggered( bool isChecked )
|
||||
topLevelWidget->hide();
|
||||
}
|
||||
// Close just the main window, it'll take care of closing the plot window
|
||||
app->mainWindow()->close();
|
||||
if ( app->mainWindow() )
|
||||
{
|
||||
app->mainWindow()->close();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -136,13 +136,17 @@ caf::PdmUiTreeView* RicToggleItemsFeatureImpl::findTreeView( const caf::PdmUiIte
|
||||
return customActiveTreeView;
|
||||
}
|
||||
|
||||
caf::PdmUiTreeView* activeTree = RiuMainWindow::instance()->getTreeViewWithItem( uiItem );
|
||||
if ( activeTree ) return activeTree;
|
||||
auto* main3dWindow = RiaGuiApplication::instance()->mainWindow();
|
||||
if ( main3dWindow )
|
||||
{
|
||||
auto activeTree = main3dWindow->getTreeViewWithItem( uiItem );
|
||||
if ( activeTree ) return activeTree;
|
||||
}
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
auto* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
if ( mainPlotWindow )
|
||||
{
|
||||
activeTree = mainPlotWindow->getTreeViewWithItem( uiItem );
|
||||
auto activeTree = mainPlotWindow->getTreeViewWithItem( uiItem );
|
||||
if ( activeTree )
|
||||
{
|
||||
return activeTree;
|
||||
|
@ -353,8 +353,8 @@ void RimProject::setupBeforeSave()
|
||||
|
||||
if ( guiApp )
|
||||
{
|
||||
m_show3DWindow = guiApp->mainWindow()->isVisible();
|
||||
m_showPlotWindow = guiApp->mainPlotWindow() && guiApp->mainPlotWindow()->isVisible();
|
||||
m_show3DWindow = guiApp->isMain3dWindowVisible();
|
||||
m_showPlotWindow = guiApp->isMainPlotWindowVisible();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user