summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/font.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-05-10 11:44:15 +0200
committerEike Rathke <erack@redhat.com>2013-05-10 14:22:07 +0200
commit4afd9a501eae7c17c3ab8adf70d2d0146bd83fe1 (patch)
tree3f181da8663178f63dfc8521a1a79d962a39eacd /vcl/source/gdi/font.cxx
parent8f0d943366f591db9142b6a9ffd9cd52b0652cbb (diff)
Font refcount is not uint16 (anymore)
Change-Id: I1aa89a8d6f712abb4f768a413ebac29e14612484
Diffstat (limited to 'vcl/source/gdi/font.cxx')
-rw-r--r--vcl/source/gdi/font.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/vcl/source/gdi/font.cxx b/vcl/source/gdi/font.cxx
index 4d313c5f1d43..94c64e10f806 100644
--- a/vcl/source/gdi/font.cxx
+++ b/vcl/source/gdi/font.cxx
@@ -240,11 +240,12 @@ Font::Font( const Font& rFont )
{
DBG_CTOR( Font, NULL );
DBG_CHKOBJ( &rFont, Font, NULL );
- DBG_ASSERT( rFont.mpImplFont->mnRefCount < 0xFFFE, "Font: RefCount overflow" );
+ bool bRefIncrementable = rFont.mpImplFont->mnRefCount < ::std::numeric_limits<FontRefCount>::max();
+ DBG_ASSERT( bRefIncrementable, "Font: RefCount overflow" );
mpImplFont = rFont.mpImplFont;
// do not count static objects (where RefCount is zero)
- if ( mpImplFont->mnRefCount )
+ if ( mpImplFont->mnRefCount && bRefIncrementable )
mpImplFont->mnRefCount++;
}
@@ -579,11 +580,12 @@ Font& Font::operator=( const Font& rFont )
{
DBG_CHKTHIS( Font, NULL );
DBG_CHKOBJ( &rFont, Font, NULL );
- DBG_ASSERT( rFont.mpImplFont->mnRefCount < 0xFFFE, "Font: RefCount overflow" );
+ bool bRefIncrementable = rFont.mpImplFont->mnRefCount < ::std::numeric_limits<FontRefCount>::max();
+ DBG_ASSERT( bRefIncrementable, "Font: RefCount overflow" );
// Increment RefCount first, so that we can reference ourselves
// RefCount == 0 for static objects
- if ( rFont.mpImplFont->mnRefCount )
+ if ( rFont.mpImplFont->mnRefCount && bRefIncrementable )
rFont.mpImplFont->mnRefCount++;
// If it's not static ImplData and if it's the last reference, delete it