#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

@@ -148,8 +148,6 @@ RiuMainWindow::RiuMainWindow()
, m_holoLensToolBar( nullptr )
, m_seismicHistogramPanel( nullptr )
{
setAttribute( Qt::WA_DeleteOnClose );
setUpCentralDockWidget();
createActions();
createMenus();
@@ -355,6 +353,12 @@ void RiuMainWindow::cleanupGuiBeforeProjectClose()
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::closeEvent( QCloseEvent* event )
{
if ( hasBeenClosed() )
{
event->accept();
return;
}
RiaGuiApplication* app = RiaGuiApplication::instance();
if ( !app->isMainPlotWindowVisible() )