diff --git a/src/mac/carbon/brush.cpp b/src/mac/carbon/brush.cpp index 95bb600893..4eacf54a31 100644 --- a/src/mac/carbon/brush.cpp +++ b/src/mac/carbon/brush.cpp @@ -129,7 +129,7 @@ void wxBrush::Unshare() { m_refData = new wxBrushRefData(); } - else + else if (m_refData->GetRefCount() > 1) { wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData); UnRef(); diff --git a/src/mac/carbon/font.cpp b/src/mac/carbon/font.cpp index 52dbecd1ba..7dced09cc4 100644 --- a/src/mac/carbon/font.cpp +++ b/src/mac/carbon/font.cpp @@ -456,7 +456,7 @@ void wxFont::Unshare() { m_refData = new wxFontRefData(); } - else + else if (m_refData->GetRefCount() > 1) { wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData); UnRef(); diff --git a/src/mac/carbon/pen.cpp b/src/mac/carbon/pen.cpp index 7f0acfebe5..59335b457f 100644 --- a/src/mac/carbon/pen.cpp +++ b/src/mac/carbon/pen.cpp @@ -93,7 +93,7 @@ void wxPen::Unshare() { m_refData = new wxPenRefData(); } - else + else if (m_refData->GetRefCount() > 1) { wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData); UnRef(); diff --git a/src/msw/font.cpp b/src/msw/font.cpp index 397a8c14f0..28b938b1a3 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -903,7 +903,7 @@ void wxFont::Unshare() { m_refData = new wxFontRefData(); } - else + else if (m_refData->GetRefCount() > 1) { wxFontRefData* ref = new wxFontRefData(*M_FONTDATA); UnRef(); diff --git a/src/msw/pen.cpp b/src/msw/pen.cpp index 92b08327a6..62065284aa 100644 --- a/src/msw/pen.cpp +++ b/src/msw/pen.cpp @@ -277,7 +277,7 @@ void wxPen::Unshare() { m_refData = new wxPenRefData(); } - else + else if (m_refData->GetRefCount() > 1) { wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData); UnRef();