Fix memory leak in ProgressStatusBar

This commit is contained in:
tamasmeszaros 2019-07-30 17:52:05 +02:00
parent ca1c78b3fc
commit cc5d74084c
2 changed files with 15 additions and 15 deletions

View File

@ -14,20 +14,20 @@
namespace Slic3r { namespace Slic3r {
ProgressStatusBar::ProgressStatusBar(wxWindow *parent, int id): ProgressStatusBar::ProgressStatusBar(wxWindow *parent, int id)
self(new wxStatusBar(parent ? parent : GUI::wxGetApp().mainframe, : self{new wxStatusBar(parent ? parent : GUI::wxGetApp().mainframe,
id == -1? wxID_ANY : id)), id == -1 ? wxID_ANY : id)}
m_timer(new wxTimer(self)), , m_prog{new wxGauge(self,
m_prog (new wxGauge(self, wxGA_HORIZONTAL,
wxGA_HORIZONTAL, 100,
100, wxDefaultPosition,
wxDefaultPosition, wxDefaultSize)}
wxDefaultSize)), , m_cancelbutton{new wxButton(self,
m_cancelbutton(new wxButton(self, -1,
-1, _(L("Cancel")),
_(L("Cancel")), wxDefaultPosition,
wxDefaultPosition, wxDefaultSize)}
wxDefaultSize)) , m_timer{new wxTimer(self)}
{ {
m_prog->Hide(); m_prog->Hide();
m_cancelbutton->Hide(); m_cancelbutton->Hide();

View File

@ -25,9 +25,9 @@ namespace Slic3r {
class ProgressStatusBar class ProgressStatusBar
{ {
wxStatusBar *self; // we cheat! It should be the base class but: perl! wxStatusBar *self; // we cheat! It should be the base class but: perl!
wxTimer *m_timer;
wxGauge *m_prog; wxGauge *m_prog;
wxButton *m_cancelbutton; wxButton *m_cancelbutton;
std::unique_ptr<wxTimer> m_timer;
public: public:
/// Cancel callback function type /// Cancel callback function type