]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/pen.mm
set m_isBeingDeleted to true (only) in SendDestroyEvent(); call it as early as possib...
[wxWidgets.git] / src / cocoa / pen.mm
index b5e6e36065644ff2db5c46c1d90954d61211d0cf..0f08a1dc3e0d03092862098422d8b439635aa7d3 100644 (file)
@@ -17,6 +17,8 @@
     #include "wx/colour.h"
 #endif //WX_PRECOMP
 
+#include "wx/cocoa/ObjcRef.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_cocoaNSColor = [data.m_cocoaNSColor retain];
+    m_cocoaNSColor = wxGCSafeRetain(data.m_cocoaNSColor);
     m_cocoaDash = NULL;
 }
 
 inline void wxPenRefData::FreeCocoaNSColor()
 {
-    [m_cocoaNSColor release];
+    wxGCSafeRelease(m_cocoaNSColor);
     m_cocoaNSColor = nil;
 }
 
@@ -156,7 +158,7 @@ inline WX_NSColor wxPenRefData::GetNSColor()
         switch( m_style )
         {
         case wxTRANSPARENT:
-            m_cocoaNSColor = [[NSColor clearColor] retain];
+            m_cocoaNSColor = wxGCSafeRetain([NSColor clearColor]);
             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];
+            [wxGCSafeRetain(m_cocoaNSColor) release]; // retain in GC. no change in RR.
             break;
         }
     }
@@ -266,12 +269,12 @@ wxPen::wxPen(const wxBitmap& stipple, int width)
     m_refData = new wxPenRefData(wxNullColour,width,wxSTIPPLE,stipple);
 }
 
-wxObjectRefData *wxPen::CreateRefData() const
+wxGDIRefData *wxPen::CreateGDIRefData() const
 {
     return new wxPenRefData;
 }
 
-wxObjectRefData *wxPen::CloneRefData(const wxObjectRefData *data) const
+wxGDIRefData *wxPen::CloneGDIRefData(const wxGDIRefData *data) const
 {
     return new wxPenRefData(*(wxPenRefData *)data);
 }
@@ -324,7 +327,7 @@ void wxPen::SetStipple(const wxBitmap& Stipple)
     M_PENDATA->SetStipple(Stipple);
 }
 
-wxColour& wxPen::GetColour() const
+wxColour wxPen::GetColour() const
 {
     return (M_PENDATA ? M_PENDATA->m_colour : wxNullColour);
 }