Ken Thomases : winemac: Make WineOpenGLContext hold a strong reference to its view.

Alexandre Julliard julliard at winehq.org
Tue Jan 14 13:44:59 CST 2014


Module: wine
Branch: master
Commit: e21192469dbd3c234e1051504b6429bd9cfb0dcf
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e21192469dbd3c234e1051504b6429bd9cfb0dcf

Author: Ken Thomases <ken at codeweavers.com>
Date:   Tue Jan 14 01:25:08 2014 -0600

winemac: Make WineOpenGLContext hold a strong reference to its view.

Its superclass, NSOpenGLContext, only holds a weak reference.  The view was
sometimes being deallocated before the context was disposed of, resulting in
crashes.

---

 dlls/winemac.drv/cocoa_opengl.m |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/dlls/winemac.drv/cocoa_opengl.m b/dlls/winemac.drv/cocoa_opengl.m
index 5ec5688..32d182f 100644
--- a/dlls/winemac.drv/cocoa_opengl.m
+++ b/dlls/winemac.drv/cocoa_opengl.m
@@ -35,10 +35,26 @@
 
     - (void) dealloc
     {
+        [[self view] release];
         [latentView release];
         [super dealloc];
     }
 
+    - (void) setView:(NSView*)newView
+    {
+        NSView* oldView = [self view];
+        [super setView:newView];
+        [newView retain];
+        [oldView release];
+    }
+
+    - (void) clearDrawable
+    {
+        NSView* oldView = [self view];
+        [super clearDrawable];
+        [oldView release];
+    }
+
     /* On at least some versions of Mac OS X, -[NSOpenGLContext clearDrawable] has the
        undesirable side effect of ordering the view's GL surface off-screen.  This isn't
        done when just changing the context's view to a different view (which I would




More information about the wine-cvs mailing list