mirror of
https://github.com/opencv/opencv.git
synced 2026-01-18 17:21:42 +01:00
Fix Qt HighGUI lifecycle issue when external QApplication exists
Respect QApplication::quitOnLastWindowClosed() before calling qApp->quit(). This prevents OpenCV from unintentionally terminating externally managed Qt applications when the last HighGUI window is closed. Fixes #28291
This commit is contained in:
@@ -854,14 +854,17 @@ GuiReceiver::GuiReceiver() : bTimeOut(false), nb_windows(0)
|
||||
|
||||
void GuiReceiver::isLastWindow()
|
||||
{
|
||||
if (--nb_windows <= 0)
|
||||
if (qApp->quitOnLastWindowClosed())
|
||||
{
|
||||
delete guiMainThread;//delete global_control_panel too
|
||||
guiMainThread = NULL;
|
||||
|
||||
if (doesExternalQAppExist)
|
||||
if (--nb_windows <= 0)
|
||||
{
|
||||
qApp->quit();
|
||||
delete guiMainThread; // delete global_control_panel too
|
||||
guiMainThread = NULL;
|
||||
|
||||
if (doesExternalQAppExist)
|
||||
{
|
||||
qApp->quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user