X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8f884a0dccd6b642f35c441ac9bfc87a6d5b4d35..fab8784c715b09462d6b05dd93a3b4776cb205c9:/src/cocoa/pen.mm diff --git a/src/cocoa/pen.mm b/src/cocoa/pen.mm index 5920dc035a..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; } } @@ -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); }