#14899: Hide main windows on close instead of deleting them

WA_DeleteOnClose left RiuMainWindow::instance() and RiuPlotMainWindow::instance() null after the user closed a window, so any unguarded use crashed. Keep both windows alive for the application lifetime and rebuild their views when a closed window is shown again.

Fixes #14899.
This commit is contained in:
Magne Sjaastad authored and JJ committed 2026-10-12 17:23:10 +02:00
1 parent 6ff9a5b46d
commit f0dc8c47f0
7 files changed
+99 -9

No files matched your search

@@ -99,8 +99,6 @@ RiuPlotMainWindow::RiuPlotMainWindow()
, m_autoUpdateEnabled( false )
, m_autoUpdateTimerId( -1 )
{
setAttribute( Qt::WA_DeleteOnClose );
setUpCentralDockWidget();
createActions();
createMenus();
@@ -275,6 +273,12 @@ void RiuPlotMainWindow::cleanUpTemporaryWidgets()
//--------------------------------------------------------------------------------------------------
void RiuPlotMainWindow::closeEvent( QCloseEvent* event )
{
if ( hasBeenClosed() )
{
event->accept();
return;
}
RiaGuiApplication* app = RiaGuiApplication::instance();
if ( !app->isMain3dWindowVisible() )
{