Fix terminal close warning spawning multiple times and allowing to crash the app.

This commit is contained in:
Martín Lucas Golini
2026-03-20 12:40:40 -03:00
parent 141dcc7f88
commit 047ce7abdd

View File

@@ -4566,7 +4566,11 @@ void App::init( InitParameters& params ) {
} else if ( mConfig.term.warnBeforeClosingTab && widget->isType( UI_TYPE_TERMINAL ) ) {
UITerminal* term = widget->asType<UITerminal>();
ProcessID pid = term->getTerm()->getTerminal()->getProcess()->pid();
std::string msgBoxId = String::format( "msgbox_%p", this );
if ( Sys::processHasChildren( pid ) ) {
if ( nullptr != getUISceneNode()->find( msgBoxId ) )
return false;
UIMessageBox* msgBox = UIMessageBox::New(
UIMessageBox::OK_CANCEL,
i18n( "terminal_close_warn", "Are you sure you want to close this "
@@ -4584,6 +4588,7 @@ void App::init( InitParameters& params ) {
msgBox->setTitle( "ecode" );
msgBox->center();
msgBox->showWhenReady();
msgBox->setId( msgBoxId );
return false;
}
}