0
0
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:
0AnshuAditya0
2025-12-26 13:36:17 +05:30
parent cff7581175
commit 5d5b5c14a9

View File

@@ -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();
}
}
}
}