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 11:40:48 +0000 (11:40 +0000)
ChangeLog
src/wx/content_menu.cc
src/wx/content_menu.h

index efd31871fa663a599ecf3c213e76fc9e84b6f556..c2d9aaf62fc94d988e5ba3042672904fdd8e6354 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-17  Carl Hetherington  <cth@carlh.net>
 
        * Prevent duplicate screen names within a cinema (#1007).
index f332dbe910744c49a6dedbaa556467cb602c9c8e..6da219f0f3dfeb16177c594dfc292f5f10bae7bf 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"));
@@ -154,7 +155,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
@@ -409,6 +412,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 ecbb4a3504e2e7a27e80e0c2c5777d48a945e594..0647331038b64d00477ca0e293abcf793d81a864 100644 (file)
@@ -55,6 +55,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;