From f6158bc3431ea9b431ca7b1367eb5ae4f5195308 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 10 Feb 2020 13:14:08 +0100 Subject: [PATCH] Remove wxHAS_PAINT_DEBUG and code guarded by it This doesn't seem to actually be doing anything useful, as it only checks that wxPaintDCImpl is not created without creating wxPaintDC which is impossible to do accidentally anyhow. This will be replaced by a more useful check in the next commit. --- include/wx/event.h | 26 +------------------------- src/msw/dcclient.cpp | 21 --------------------- 2 files changed, 1 insertion(+), 46 deletions(-) diff --git a/include/wx/event.h b/include/wx/event.h index 482758b7a2..293211aae3 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -2335,39 +2335,15 @@ private: wxEVT_NC_PAINT */ -#if wxDEBUG_LEVEL && defined(__WXMSW__) - #define wxHAS_PAINT_DEBUG - - // see comments in src/msw/dcclient.cpp where g_isPainting is defined - extern WXDLLIMPEXP_CORE int g_isPainting; -#endif // debug - class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent { public: wxPaintEvent(int Id = 0) : wxEvent(Id, wxEVT_PAINT) { -#ifdef wxHAS_PAINT_DEBUG - // set the internal flag for the duration of redrawing - g_isPainting++; -#endif // debug } - // default copy ctor and dtor are normally fine, we only need them to keep - // g_isPainting updated in debug build -#ifdef wxHAS_PAINT_DEBUG - wxPaintEvent(const wxPaintEvent& event) - : wxEvent(event) - { - g_isPainting++; - } - - virtual ~wxPaintEvent() - { - g_isPainting--; - } -#endif // debug + // default copy ctor and dtor are fine virtual wxEvent *Clone() const wxOVERRIDE { return new wxPaintEvent(*this); } diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index ed6fcf3e9e..2b628ef97d 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -138,18 +138,6 @@ PaintDCInfos gs_PaintDCInfos; } // anonymous namespace -// ---------------------------------------------------------------------------- -// global variables -// ---------------------------------------------------------------------------- - -#ifdef wxHAS_PAINT_DEBUG - // a global variable which we check to verify that wxPaintDC are only - // created in response to WM_PAINT message - doing this from elsewhere is a - // common programming error among wxWidgets programmers and might lead to - // very subtle and difficult to debug refresh/repaint bugs. - int g_isPainting = 0; -#endif // wxHAS_PAINT_DEBUG - // =========================================================================== // implementation // =========================================================================== @@ -269,15 +257,6 @@ wxPaintDCImpl::wxPaintDCImpl( wxDC *owner, wxWindow *window ) : { wxCHECK_RET( window, wxT("NULL canvas in wxPaintDCImpl ctor") ); -#ifdef wxHAS_PAINT_DEBUG - if ( g_isPainting <= 0 ) - { - wxFAIL_MSG( wxT("wxPaintDCImpl may be created only in EVT_PAINT handler!") ); - - return; - } -#endif // wxHAS_PAINT_DEBUG - // see comments in src/msw/window.cpp where this is defined extern wxStack wxDidCreatePaintDC;