X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f55c979a009b3c364e60731670f5698b448ba963..359cde15e07bd684c9175b51c04ab02c9ee40745:/src/cocoa/pen.mm diff --git a/src/cocoa/pen.mm b/src/cocoa/pen.mm index b5e6e36065..5ff2d91a51 100644 --- a/src/cocoa/pen.mm +++ b/src/cocoa/pen.mm @@ -6,7 +6,7 @@ // Created: 2003/08/02 // RCS-ID: $Id$ // Copyright: (c) 2003 David Elliott -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #include "wx/wxprec.h" @@ -17,6 +17,8 @@ #include "wx/colour.h" #endif //WX_PRECOMP +#include "wx/cocoa/ObjcRef.h" + #import // ======================================================================== @@ -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); }