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

Ken Thomases ken at codeweavers.com
Thu Jan 29 23:04:48 CST 2015


On Jan 29, 2015, at 5:23 PM, Charles Davis <cdavis5x at gmail.com> wrote:

> 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.

Nice.  I was aware of the warning but assumed that it was benign.  I'm not sure it's a coincidence that it worked in 32-bit.  I don't think that dispatch objects are actually automatically retained by blocks which reference them in 32-bit.  It's not entirely related, but it's relatively recent that ARC started doing that and, of course, that requires the modern Objective-C runtime and thus 64-bit.

Anyway, I'm glad the Mac driver crashiness in the 64-bit build stemmed from a single cause.  I'm sure it wasn't fun to find it.  Thanks for doing so.

-Ken




More information about the wine-devel mailing list