]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/pen.mm
cleaning up common OSX code
[wxWidgets.git] / src / cocoa / pen.mm
index 5920dc035a78f0f5a0095bf999e9bb5e35689d3c..d94b138c1a791af272214db3e8fa336c0fc00271 100644 (file)
@@ -17,6 +17,8 @@
     #include "wx/colour.h"
 #endif //WX_PRECOMP
 
     #include "wx/colour.h"
 #endif //WX_PRECOMP
 
+#include "wx/cocoa/ObjcRef.h"
+
 #import <AppKit/NSColor.h>
 
 // ========================================================================
 #import <AppKit/NSColor.h>
 
 // ========================================================================
@@ -133,13 +135,13 @@ inline wxPenRefData::wxPenRefData(const wxPenRefData& data)
     m_nbDash = data.m_nbDash;
     m_dash = data.m_dash;
     m_stipple = data.m_stipple;
     m_nbDash = data.m_nbDash;
     m_dash = data.m_dash;
     m_stipple = data.m_stipple;
-    m_cocoaNSColor = [data.m_cocoaNSColor retain];
+    m_cocoaNSColor = wxGCSafeRetain(data.m_cocoaNSColor);
     m_cocoaDash = NULL;
 }
 
 inline void wxPenRefData::FreeCocoaNSColor()
 {
     m_cocoaDash = NULL;
 }
 
 inline void wxPenRefData::FreeCocoaNSColor()
 {
-    [m_cocoaNSColor release];
+    wxGCSafeRelease(m_cocoaNSColor);
     m_cocoaNSColor = nil;
 }
 
     m_cocoaNSColor = nil;
 }
 
@@ -156,7 +158,7 @@ inline WX_NSColor wxPenRefData::GetNSColor()
         switch( m_style )
         {
         case wxTRANSPARENT:
         switch( m_style )
         {
         case wxTRANSPARENT:
-            m_cocoaNSColor = [[NSColor clearColor] retain];
+            m_cocoaNSColor = wxGCSafeRetain([NSColor clearColor]);
             break;
         case wxSTIPPLE:
 //  wxBitmap isn't implemented yet
             break;
         case wxSTIPPLE:
 //  wxBitmap isn't implemented yet
@@ -181,6 +183,7 @@ inline WX_NSColor wxPenRefData::GetNSColor()
             if(!colour_NSColor)
                 colour_NSColor = [NSColor clearColor];
             m_cocoaNSColor = [colour_NSColor copyWithZone:nil];
             if(!colour_NSColor)
                 colour_NSColor = [NSColor clearColor];
             m_cocoaNSColor = [colour_NSColor copyWithZone:nil];
+            [wxGCSafeRetain(m_cocoaNSColor) release]; // retain in GC. no change in RR.
             break;
         }
     }
             break;
         }
     }