98772641729700876a0e51e3d001649cd1624046 from master; Windows crash fix.
authorCarl Hetherington <cth@carlh.net>
Mon, 4 May 2015 00:39:33 +0000 (01:39 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 4 May 2015 00:39:33 +0000 (01:39 +0100)
ChangeLog
TO_PORT
src/wx/config_dialog.cc

index 78ca54717b08aca8c9ab9eff500fa22ccfaea7b7..9f1ab14ba0184c0d45f0dff23044399986ebd9f2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-05-04  Carl Hetherington  <cth@carlh.net>
 
+       * 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  <cth@carlh.net>
diff --git a/TO_PORT b/TO_PORT
index 78fa0c6584171a55cfc175879164a0dce0c901d7..5bc34571538818cac707a59f19c0d96997d87841 100644 (file)
--- a/TO_PORT
+++ b/TO_PORT
@@ -1,2 +1 @@
-bf884630d6758c252d0d2c4fa5e866677cda66be
 add9a03356d3d392e234354df4800b9042e0f426
index d5700b8921ef8f58055b650e60f6432df55c3b31..67ce701f9c95153f1fcdbb23d5499019d0b4ccfc 100644 (file)
@@ -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