Forbid creation of wxPaintEvent objects from user code

This doesn't work anyhow, so it's better to prevent the code doing this
from compiling instead of getting run-time asserts or worse.

Also simplify construction of these events inside wxWidgets by passing
the window itself to the ctor instead of passing just its ID and calling
SetEventObject() separately later.

For consistency, do the same thing for wxNcPaintEvent too.
This commit is contained in:
Vadim Zeitlin
2020-02-10 14:08:53 +01:00
parent b680ba9596
commit 8fcf46f65c
17 changed files with 65 additions and 46 deletions

View File

@@ -1281,8 +1281,7 @@ bool wxWindowQt::QtHandlePaintEvent ( QWidget *handler, QPaintEvent *event )
}
// send the paint event (wxWindowDC will draw directly):
wxPaintEvent paint( GetId() );
paint.SetEventObject(this);
wxPaintEvent paint( this );
handled = ProcessWindowEvent(paint);
m_updateRegion.Clear();
}