XQuartz: Avoid a race in initialization of darwinPointer

http://xquartz.macosforge.org/trac/ticket/579Signed-off-by: Jeremy Huddleston Sequoia's avatarJeremy Huddleston <jeremyhu@apple.com>
parent c4952113
......@@ -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 ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment