diff --git a/interface/wx/window.h b/interface/wx/window.h index e3780555a2..4ac6a5b0a3 100644 --- a/interface/wx/window.h +++ b/interface/wx/window.h @@ -1423,8 +1423,14 @@ public: //@{ /** - Clears the window by filling it with the current background colour. Does not - cause an erase background event to be generated. + Clears the window by filling it with the current background colour. + + Does not cause an erase background event to be generated. + + Notice that this uses wxClientDC to draw on the window and the results + of doing it while also drawing on wxPaintDC for this window are + undefined. Hence this method shouldn't be used from EVT_PAINT handlers, + just use wxDC::Clear() on the wxPaintDC you already use there instead. */ virtual void ClearBackground(); diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 9a99f1487f..464d3f2733 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -185,11 +185,8 @@ private: { wxPaintDC dc(this); -#ifndef __WXOSX__ - // on OSX the immediate Update from within ClearBackground leads to a recursion if ( GetMenuBar()->IsChecked(ID_PAINT_BG) ) - ClearBackground(); -#endif + dc.Clear(); dc.SetUserScale(m_zoom, m_zoom);