X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e0da9e871a3184daa1a32bcacbfdf6ddb9ed7db4..2a45803fc3877afd0ae3ce356dfe216505165882:/include/wx/private/textmeasure.h diff --git a/include/wx/private/textmeasure.h b/include/wx/private/textmeasure.h index 4788c992ed..393946e7bf 100644 --- a/include/wx/private/textmeasure.h +++ b/include/wx/private/textmeasure.h @@ -75,6 +75,9 @@ public: virtual void BeginMeasuring() { } virtual void EndMeasuring() { } + // This is another method which is only used by MeasuringGuard. + bool IsUsingDCImpl() const { return m_useDCImpl; } + protected: // RAII wrapper for the two methods above. class MeasuringGuard @@ -82,12 +85,16 @@ protected: public: MeasuringGuard(wxTextMeasureBase& tm) : m_tm(tm) { - m_tm.BeginMeasuring(); + // BeginMeasuring() should only be called if we have a native DC, + // so don't call it if we delegate to a DC of unknown type. + if ( !m_tm.IsUsingDCImpl() ) + m_tm.BeginMeasuring(); } ~MeasuringGuard() { - m_tm.EndMeasuring(); + if ( !m_tm.IsUsingDCImpl() ) + m_tm.EndMeasuring(); } private: