winemac: Call -removeFromSuperview on a view before adding it to a superview, on 10.9 and earlier.

Ken Thomases ken at codeweavers.com
Fri Jul 22 01:25:06 CDT 2016


This works around a Cocoa bug that causes an exception and hang if the view is
being re-ordered within its current superview (as opposed to being moved to a
new superview).

This reverts commit 9fbc364ea103239553701aa9a9932e3fdabcfff6 but adds some
conditions around the call to avoid the flicker on platforms where it's
unnecessary.

Signed-off-by: Ken Thomases <ken at codeweavers.com>
---
For <https://bugs.winehq.org/show_bug.cgi?id=40987>.

 dlls/winemac.drv/cocoa_window.m | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index 808a7e7..c6e0709 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -3357,6 +3357,10 @@ void macdrv_set_view_superview(macdrv_view v, macdrv_view s, macdrv_window w, ma
         WineWindow* oldWindow = (WineWindow*)[view window];
         WineWindow* newWindow = (WineWindow*)[superview window];
 
+#if !defined(MAC_OS_X_VERSION_10_10) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
+        if (floor(NSAppKitVersionNumber) <= 1265 /*NSAppKitVersionNumber10_9*/)
+            [view removeFromSuperview];
+#endif
         if (prev)
             [superview addSubview:view positioned:NSWindowBelow relativeTo:prev];
         else
-- 
2.8.2




More information about the wine-patches mailing list