diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2012-05-17 10:08:02 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2012-05-17 16:32:06 -0700 |
commit | acdc4f54ee5784d26c251ff8c941b4360ae80e9b (patch) | |
tree | ed1980b721e4f0181a9b2c043695dae913e1cfce /hw/xquartz | |
parent | c495211373a118acee02a29c6eb25a332abc856c (diff) |
XQuartz: Avoid a race in initialization of darwinPointer
http://xquartz.macosforge.org/trac/ticket/579
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'hw/xquartz')
-rw-r--r-- | hw/xquartz/X11Application.m | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 9f4c9b71e..1f9b05dd1 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -1329,6 +1329,11 @@ untrusted_str(NSEvent *e) } #endif +extern void +darwinEvents_lock(void); +extern void +darwinEvents_unlock(void); + - (void) sendX11NSEvent:(NSEvent *)e { NSPoint location = NSZeroPoint; @@ -1341,18 +1346,15 @@ untrusted_str(NSEvent *e) int modifierFlags; BOOL isMouseOrTabletEvent, isTabletEvent; -#ifdef HAVE_LIBDISPATCH - static dispatch_once_t once_pred; - dispatch_once(&once_pred, ^{ - tilt = NSZeroPoint; - darwinTabletCurrent = darwinTabletStylus; - }); -#else if (!darwinTabletCurrent) { + /* Ensure that the event system is initialized */ + darwinEvents_lock(); + darwinEvents_unlock(); + assert(darwinTabletStylus); + tilt = NSZeroPoint; darwinTabletCurrent = darwinTabletStylus; } -#endif isMouseOrTabletEvent = [e type] == NSLeftMouseDown || [e type] == NSOtherMouseDown || |