From f7a3f628ead46d7c31598de6cd0d97f8ff0bdbd6 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 4 May 2015 01:39:33 +0100 Subject: [PATCH] 98772641729700876a0e51e3d001649cd1624046 from master; Windows crash fix. --- ChangeLog | 3 +++ TO_PORT | 1 - src/wx/config_dialog.cc | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78ca54717..9f1ab14ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2015-05-04 Carl Hetherington + * Don't try to update config dialog when its window has been + destroyed. Fixes various crashes on Windows (from master). + * Add a simple content properties dialog (#554). 2015-05-01 carl diff --git a/TO_PORT b/TO_PORT index 78fa0c658..5bc345715 100644 --- a/TO_PORT +++ b/TO_PORT @@ -1,2 +1 @@ -bf884630d6758c252d0d2c4fa5e866677cda66be add9a03356d3d392e234354df4800b9042e0f426 diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index d5700b892..67ce701f9 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -65,11 +65,13 @@ public: : _border (border) , _panel (0) , _panel_size (panel_size) - , _created (false) + , _window_exists (false) { _config_connection = Config::instance()->Changed.connect (boost::bind (&Page::config_changed_wrapper, this)); } + virtual ~Page () {} + protected: wxWindow* create_window (wxWindow* parent) { @@ -78,8 +80,10 @@ protected: _panel->SetSizer (s); setup (); - _created = true; + _window_exists = true; config_changed (); + + _panel->Bind (wxEVT_DESTROY, boost::bind (&Page::window_destroyed, this)); return _panel; } @@ -93,14 +97,19 @@ private: void config_changed_wrapper () { - if (_created) { + if (_window_exists) { config_changed (); } } + void window_destroyed () + { + _window_exists = false; + } + wxSize _panel_size; boost::signals2::scoped_connection _config_connection; - bool _created; + bool _window_exists; }; class StockPage : public wxStockPreferencesPage, public Page -- 2.30.2