Jan Engelhardt
2014-01-27 22:20:53 UTC
A small testcase which crashes with wxGTK 3 if the dtor is not
specified. Is this supposed to act as such? Perhaps the wxTimer
documentation should say something about deleting a window in which a
timer is active.
As the timer is (in this case) attached to the wxFrame which itself
is a EvtHandler, would it be possible to scan for all timers in
wxWindow::~wxWindow and destroy the attached timers?
#include <wx/wx.h>
#include <cstdio>
class myFrame : public wxFrame {
public:
void OnTime(wxTimerEvent &) {};
wxTimer *t;
myFrame(wxWindow *p) : wxFrame(p, wxID_ANY, wxEmptyString) {
t = new wxTimer(this);
t->Start(1000, wxTIMER_ONE_SHOT);
};
//~myFrame(void) { delete t; };
};
class myApp : public wxApp {
private: bool OnInit(void) {
wxFrame *a = new myFrame(NULL);
a->Show();
wxFrame *b = new myFrame(a);
b->Destroy();
return true;
};
};
IMPLEMENT_APP(myApp);
specified. Is this supposed to act as such? Perhaps the wxTimer
documentation should say something about deleting a window in which a
timer is active.
As the timer is (in this case) attached to the wxFrame which itself
is a EvtHandler, would it be possible to scan for all timers in
wxWindow::~wxWindow and destroy the attached timers?
#include <wx/wx.h>
#include <cstdio>
class myFrame : public wxFrame {
public:
void OnTime(wxTimerEvent &) {};
wxTimer *t;
myFrame(wxWindow *p) : wxFrame(p, wxID_ANY, wxEmptyString) {
t = new wxTimer(this);
t->Start(1000, wxTIMER_ONE_SHOT);
};
//~myFrame(void) { delete t; };
};
class myApp : public wxApp {
private: bool OnInit(void) {
wxFrame *a = new myFrame(NULL);
a->Show();
wxFrame *b = new myFrame(a);
b->Destroy();
return true;
};
};
IMPLEMENT_APP(myApp);
--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.
To unsubscribe, send email to wx-users+***@googlegroups.com
or visit http://groups.google.com/group/wx-users