diff options
Diffstat (limited to 'src/kernel/qrichtext_p.cpp')
-rw-r--r-- | src/kernel/qrichtext_p.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/kernel/qrichtext_p.cpp b/src/kernel/qrichtext_p.cpp index 4411b4d45..022eb13de 100644 --- a/src/kernel/qrichtext_p.cpp +++ b/src/kernel/qrichtext_p.cpp @@ -337,6 +337,19 @@ int TQTextFormat::pntr_asc=-1; int TQTextFormat::pntr_hei=-1; int TQTextFormat::pntr_dsc=-1; +void TQTextFormat::cleanupPrivateData() { + delete TQTextFormat::pntr_fm; + TQTextFormat::pntr_fm = 0; + TQTextFormat::pntr = 0; + + // Not really necessary, but better to tidy-up everything + TQTextFormat::pntr_fm = 0; + TQTextFormat::pntr_ldg=-1; + TQTextFormat::pntr_asc=-1; + TQTextFormat::pntr_hei=-1; + TQTextFormat::pntr_dsc=-1; +} + void TQTextFormat::setPainter( TQPainter *p ) { pntr = p; @@ -350,10 +363,16 @@ TQPainter* TQTextFormat::painter() void TQTextFormat::applyFont( const TQFont &f ) { TQFontMetrics fm( pntr->fontMetrics() ); + + if ( !pntr_fm ) { + tqAddPostRoutine( &TQTextFormat::cleanupPrivateData ); + } + if ( !pntr_fm || pntr_fm->painter != pntr || pntr_fm->d != fm.d - || !pntr->font().isCopyOf( f ) ) { + || !pntr->font().isCopyOf( f ) + ) { pntr->setFont( f ); delete pntr_fm; pntr_fm = new TQFontMetrics( pntr->fontMetrics() ); |