diff options
author | Joshua Duong <joshuaduong@google.com> | 2024-05-05 23:27:56 -0700 |
---|---|---|
committer | Joshua Duong <joshuaduong@google.com> | 2024-05-05 23:32:11 -0700 |
commit | a5d12882d5191ac5777599b2cbd37d4b9942e511 (patch) | |
tree | 97fc4bce37fbfa048592f4e323a6cff59e029a48 | |
parent | fa47ed5834e7768146d3f385ee679660f6d9c4e1 (diff) | |
download | qemu-a5d12882d5191ac5777599b2cbd37d4b9942e511.tar.gz |
[embedded] Fix Qt main loop hang on exit.
On mac in embedded mode, the Qt main loop may not terminate
because QCoreApplication::quit() never gets called. So we
call it explicitly.
Bug: 338084862
Test: emulator -qt-hide-window
Verify snapshot save is successful on shutdown.
Change-Id: I7b10fe986941b2fa9d31c7114787fb47a106e2c8
-rw-r--r-- | android/android-ui/modules/aemu-ui-qt/src/android/skin/qt/emulator-container.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/android/android-ui/modules/aemu-ui-qt/src/android/skin/qt/emulator-container.cpp b/android/android-ui/modules/aemu-ui-qt/src/android/skin/qt/emulator-container.cpp index 09f286c006..647f29a1ec 100644 --- a/android/android-ui/modules/aemu-ui-qt/src/android/skin/qt/emulator-container.cpp +++ b/android/android-ui/modules/aemu-ui-qt/src/android/skin/qt/emulator-container.cpp @@ -272,6 +272,14 @@ void EmulatorContainer::closeEvent(QCloseEvent* event) { slot_hideModalOverlay(); slot_hideVirtualSceneInfoDialog(); mEmulatorWindow->closeEvent(event); + // In embedded mode, sometimes QCoreApplication::quit() doesn't get called, + // which means the Qt main loop never quits. So let's explicitly call quit() + // here prevent that situation from occurring. + if (getConsoleAgents() + ->settings->android_cmdLineOptions() + ->qt_hide_window) { + qApp->quit(); + } } void EmulatorContainer::focusInEvent(QFocusEvent* event) { |