Attempt to fix crash on hitting enter in the crop control on Windows (#1009).
authorCarl Hetherington <cth@carlh.net>
Wed, 23 Nov 2016 11:40:48 +0000 (11:40 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 23 Nov 2016 12:03:19 +0000 (12:03 +0000)
ChangeLog
src/wx/content_menu.cc
src/wx/content_menu.h

index 3a3a5f5a0a1542f3d65f3b795507d33fb52764f8..cf42da9d5aa957849fd55a226e16905cf8fbacbd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-11-23  Carl Hetherington  <cth@carlh.net>
+
+       * Fix crash on pressing enter in a crop control on Windows (#1009).
+
 2016-11-16  Carl Hetherington  <cth@carlh.net>
 
        * Version 2.10.1 released.
index 14632d984797f83cbcc3949e6dfb62859d615591..df8fcfd13ad4695b2b90cc6efa8a1894c399df97 100644 (file)
@@ -66,6 +66,7 @@ enum {
 ContentMenu::ContentMenu (wxWindow* p)
        : _menu (new wxMenu)
        , _parent (p)
+       , _pop_up_open (false)
 {
        _repeat = _menu->Append (ID_repeat, _("Repeat..."));
        _join = _menu->Append (ID_join, _("Join"));
@@ -164,7 +165,9 @@ ContentMenu::popup (weak_ptr<Film> film, ContentList c, TimelineContentViewList
 
        _remove->Enable (!_content.empty ());
 
+       _pop_up_open = true;
        _parent->PopupMenu (_menu, p);
+       _pop_up_open = false;
 }
 
 void
@@ -421,6 +424,10 @@ ContentMenu::properties ()
 void
 ContentMenu::cpl_selected (wxCommandEvent& ev)
 {
+       if (!_pop_up_open) {
+               return;
+       }
+
        DCPOMATIC_ASSERT (!_content.empty ());
        shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (_content.front ());
        DCPOMATIC_ASSERT (dcp);
index 84daa71a56e0cd13a749471699d79ab5e0f27e1d..f0f1ae39f4161919f386b6651666bdbd8a56f301 100644 (file)
@@ -56,6 +56,7 @@ private:
        /** Film that we are working with; set up by popup() */
        boost::weak_ptr<Film> _film;
        wxWindow* _parent;
+       bool _pop_up_open;
        ContentList _content;
        TimelineContentViewList _views;
        wxMenuItem* _repeat;