qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] This patch fixes hanging up Cocoa display on macOS 10.15 (Catali


From: hikarupsp
Subject: [PATCH] This patch fixes hanging up Cocoa display on macOS 10.15 (Catalina)
Date: Mon, 14 Oct 2019 21:52:54 +0900

From: Hikaru Nishida <address@hidden>

An NSEvent is fired before applicationDidFinishLaunching on macOS
Catalina. This causes deadlock of iothread_lock by calling
bool_with_iothread_lock in handleEvent while its already locked.
This patch prevents to call bool_with_iothread_lock until the
app_started_sem is released to prevent this deadlock.

Buglink: https://bugs.launchpad.net/qemu/+bug/1847906
Signed-off-by: Hikaru Nishida <address@hidden>
---
 ui/cocoa.m | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index f12e21df6e..f16d341a0a 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -134,6 +134,7 @@
 
 static QemuSemaphore display_init_sem;
 static QemuSemaphore app_started_sem;
+volatile sig_atomic_t allow_events;
 
 // Utility functions to run specified code block with iothread lock held
 typedef void (^CodeBlock)(void);
@@ -729,6 +730,9 @@ - (void) handleMonitorInput:(NSEvent *)event
 
 - (bool) handleEvent:(NSEvent *)event
 {
+    if(!allow_events) {
+        return false;
+    }
     return bool_with_iothread_lock(^{
         return [self handleEventLocked:event];
     });
@@ -1897,6 +1901,7 @@ static void cocoa_display_init(DisplayState *ds, 
DisplayOptions *opts)
     /* Tell main thread to go ahead and create the app and enter the run loop 
*/
     qemu_sem_post(&display_init_sem);
     qemu_sem_wait(&app_started_sem);
+    allow_events = true;
     COCOA_DEBUG("cocoa_display_init: app start completed\n");
 
     /* if fullscreen mode is to be used */
-- 
2.21.0 (Apple Git-122)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]