diff --git a/include/wx/timer.h b/include/wx/timer.h index fb15b3551b..42af63d9a9 100644 --- a/include/wx/timer.h +++ b/include/wx/timer.h @@ -161,21 +161,29 @@ class WXDLLIMPEXP_BASE wxTimerEvent : public wxEvent public: wxTimerEvent(wxTimer& timer) : wxEvent(timer.GetId(), wxEVT_TIMER), - m_timer(timer) + m_timer(&timer) { SetEventObject(timer.GetOwner()); } // accessors - int GetInterval() const { return m_timer.GetInterval(); } - wxTimer& GetTimer() const { return m_timer; } + int GetInterval() const { return m_timer->GetInterval(); } + wxTimer& GetTimer() const { return *m_timer; } // implement the base class pure virtual virtual wxEvent *Clone() const wxOVERRIDE { return new wxTimerEvent(*this); } virtual wxEventCategory GetEventCategory() const wxOVERRIDE { return wxEVT_CATEGORY_TIMER; } + // default ctor creates an unusable event object and should not be used (in + // fact, no code outside wxWidgets is supposed to create event objects) +#if WXWIN_COMPATIBILITY_3_0 + wxDEPRECATED_MSG("wxTimerEvent not supposed to be created by user code") + wxTimerEvent() + : wxEvent(wxID_ANY, wxEVT_TIMER) { m_timer=NULL; } +#endif // WXWIN_COMPATIBILITY_3_0 + private: - wxTimer& m_timer; + wxTimer* m_timer; wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxTimerEvent); };