mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#7778 MainWindow: fix crash when reopening grid case
This commit is contained in:
parent
837a0f208c
commit
9678b80feb
@ -189,6 +189,7 @@ RiaGuiApplication::RiaGuiApplication( int& argc, char** argv )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiaGuiApplication::~RiaGuiApplication()
|
RiaGuiApplication::~RiaGuiApplication()
|
||||||
{
|
{
|
||||||
|
m_mainWindow.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -923,7 +924,7 @@ RiuMainWindow* RiaGuiApplication::getOrCreateAndShowMainWindow()
|
|||||||
m_mainWindow->loadWinGeoAndDockToolBarLayout();
|
m_mainWindow->loadWinGeoAndDockToolBarLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_mainWindow.get();
|
return m_mainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -931,7 +932,7 @@ RiuMainWindow* RiaGuiApplication::getOrCreateAndShowMainWindow()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuMainWindow* RiaGuiApplication::mainWindow()
|
RiuMainWindow* RiaGuiApplication::mainWindow()
|
||||||
{
|
{
|
||||||
return m_mainWindow.get();
|
return m_mainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -960,7 +961,7 @@ void RiaGuiApplication::createMainWindow()
|
|||||||
caf::CmdExecCommandManager::instance()->enableUndoCommandSystem( true );
|
caf::CmdExecCommandManager::instance()->enableUndoCommandSystem( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainWindow = std::make_unique<RiuMainWindow>();
|
m_mainWindow = new RiuMainWindow;
|
||||||
QString platform = cvf::System::is64Bit() ? "(64bit)" : "(32bit)";
|
QString platform = cvf::System::is64Bit() ? "(64bit)" : "(32bit)";
|
||||||
m_mainWindow->setWindowTitle( "ResInsight " + platform );
|
m_mainWindow->setWindowTitle( "ResInsight " + platform );
|
||||||
m_mainWindow->setDefaultWindowSize();
|
m_mainWindow->setDefaultWindowSize();
|
||||||
@ -1042,7 +1043,7 @@ RiuPlotMainWindow* RiaGuiApplication::mainPlotWindow()
|
|||||||
RiuMainWindowBase* RiaGuiApplication::mainWindowByID( int mainWindowID )
|
RiuMainWindowBase* RiaGuiApplication::mainWindowByID( int mainWindowID )
|
||||||
{
|
{
|
||||||
if ( mainWindowID == 0 )
|
if ( mainWindowID == 0 )
|
||||||
return m_mainWindow.get();
|
return m_mainWindow;
|
||||||
else if ( mainWindowID == 1 )
|
else if ( mainWindowID == 1 )
|
||||||
return m_mainPlotWindow.get();
|
return m_mainPlotWindow.get();
|
||||||
else
|
else
|
||||||
@ -1451,7 +1452,7 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences*
|
|||||||
}
|
}
|
||||||
|
|
||||||
QMessageBox::StandardButton reply;
|
QMessageBox::StandardButton reply;
|
||||||
reply = QMessageBox::question( m_mainWindow.get(),
|
reply = QMessageBox::question( m_mainWindow,
|
||||||
QString( "Apply %1 to Existing Views or Plots?" ).arg( listString ),
|
QString( "Apply %1 to Existing Views or Plots?" ).arg( listString ),
|
||||||
QString( "You have changed default %1 and have existing views or plots with "
|
QString( "You have changed default %1 and have existing views or plots with "
|
||||||
"different settings.\n" )
|
"different settings.\n" )
|
||||||
|
@ -166,7 +166,7 @@ private slots:
|
|||||||
void onLastWindowClosed();
|
void onLastWindowClosed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<RiuMainWindow> m_mainWindow;
|
QPointer<RiuMainWindow> m_mainWindow;
|
||||||
std::unique_ptr<RiuPlotMainWindow> m_mainPlotWindow;
|
std::unique_ptr<RiuPlotMainWindow> m_mainPlotWindow;
|
||||||
|
|
||||||
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
#include "RicShowMainWindowFeature.h"
|
#include "RicShowMainWindowFeature.h"
|
||||||
|
|
||||||
|
#include "RiaGuiApplication.h"
|
||||||
|
|
||||||
#include "RiuMainWindow.h"
|
#include "RiuMainWindow.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
@ -31,19 +33,27 @@ void RicShowMainWindowFeature::showMainWindow()
|
|||||||
{
|
{
|
||||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||||
|
|
||||||
if ( mainWnd->isMinimized() )
|
if ( mainWnd )
|
||||||
{
|
{
|
||||||
mainWnd->showNormal();
|
if ( mainWnd->isMinimized() )
|
||||||
mainWnd->update();
|
{
|
||||||
|
mainWnd->showNormal();
|
||||||
|
mainWnd->update();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mainWnd->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
mainWnd->raise();
|
||||||
|
|
||||||
|
mainWnd->restoreDockWidgetVisibilities();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mainWnd->show();
|
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||||
|
app->getOrCreateAndShowMainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWnd->raise();
|
|
||||||
|
|
||||||
mainWnd->restoreDockWidgetVisibilities();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -121,6 +121,8 @@ RiuMainWindow::RiuMainWindow()
|
|||||||
, m_windowMenu( nullptr )
|
, m_windowMenu( nullptr )
|
||||||
, m_holoLensToolBar( nullptr )
|
, m_holoLensToolBar( nullptr )
|
||||||
{
|
{
|
||||||
|
setAttribute( Qt::WA_DeleteOnClose );
|
||||||
|
|
||||||
m_mdiArea = new RiuMdiArea( this );
|
m_mdiArea = new RiuMdiArea( this );
|
||||||
connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) );
|
connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) );
|
||||||
setCentralWidget( m_mdiArea );
|
setCentralWidget( m_mdiArea );
|
||||||
@ -171,6 +173,11 @@ RiuMainWindow::RiuMainWindow()
|
|||||||
RiuMainWindow::~RiuMainWindow()
|
RiuMainWindow::~RiuMainWindow()
|
||||||
{
|
{
|
||||||
setPdmRoot( nullptr );
|
setPdmRoot( nullptr );
|
||||||
|
|
||||||
|
if ( m_pdmUiPropertyView )
|
||||||
|
{
|
||||||
|
m_pdmUiPropertyView->showProperties( nullptr );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -48,7 +48,6 @@ RiuMdiSubWindow::RiuMdiSubWindow( QWidget* parent /*= 0*/, Qt::WindowFlags flags
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuMdiSubWindow::~RiuMdiSubWindow()
|
RiuMdiSubWindow::~RiuMdiSubWindow()
|
||||||
{
|
{
|
||||||
RiuMainWindow::instance()->slotRefreshViewActions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user