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:
@@ -534,3 +534,14 @@ public:
|
||||
void OnIdle(wxIdleEvent&) { }
|
||||
};
|
||||
#endif // C++11
|
||||
|
||||
// Another compilation-time-only test, but this one checking that these event
|
||||
// objects can't be created from outside of the library.
|
||||
#ifdef TEST_INVALID_EVENT_CREATION
|
||||
|
||||
void TestEventCreation()
|
||||
{
|
||||
wxPaintEvent eventPaint;
|
||||
}
|
||||
|
||||
#endif // TEST_INVALID_EVENT_CREATION
|
||||
|
Reference in New Issue
Block a user