[PATCH] winemac.drv: Always initialize a closure-captured object pointer.

Charles Davis cdavis5x at gmail.com
Thu Jan 29 17:23:25 CST 2015


You might argue that we don't need to do this because we only use it on
the control paths where we initialize it. Ah, but it *is* used on one of
the other paths: it is captured by the Block closure whether or not we
actually use it inside the Block. This means that, when we copy the
Block onto the heap in OnMainThreadAsync(), the runtime will attempt to
retain it. For some reason, we got away with this in 32-bit
land--probably because the pointer happened to be NULL anyway--but it
broke and died horribly on 64-bit.

With this change, 64-bit winemac.drv is actually usable.
---
 dlls/winemac.drv/cocoa_event.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/winemac.drv/cocoa_event.m b/dlls/winemac.drv/cocoa_event.m
index 757ad6b..c011f8d 100644
--- a/dlls/winemac.drv/cocoa_event.m
+++ b/dlls/winemac.drv/cocoa_event.m
@@ -470,7 +470,7 @@ void OnMainThread(dispatch_block_t block)
     NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
     NSMutableDictionary* threadDict = [[NSThread currentThread] threadDictionary];
     WineEventQueue* queue = [threadDict objectForKey:WineEventQueueThreadDictionaryKey];
-    dispatch_semaphore_t semaphore;
+    dispatch_semaphore_t semaphore = NULL;
     __block BOOL finished;
 
     if (!queue)
-- 
2.2.2




More information about the wine-patches mailing list