set ControlProtocol::_first_selected_stripable at the right time only
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 7 Jul 2016 00:58:07 +0000 (20:58 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 7 Jul 2016 00:58:33 +0000 (20:58 -0400)
libs/surfaces/control_protocol/control_protocol.cc

index 8accb99ea28b7dc23fa3bc02fa36a8a79d0c798d..8c2a1217790063cd4650d6debddda2a54149f41e 100644 (file)
@@ -360,13 +360,17 @@ ControlProtocol::set_first_selected_stripable (boost::shared_ptr<Stripable> s)
 void
 ControlProtocol::stripable_selection_changed (StripableNotificationListPtr sp)
 {
+       bool had_selection = !_last_selected.empty();
+
        _last_selected = *sp;
 
        {
                Glib::Threads::Mutex::Lock lm (first_selected_mutex);
 
                if (!_last_selected.empty()) {
-                       _first_selected_stripable = _last_selected.front().lock();
+                       if (!had_selection) {
+                               _first_selected_stripable = _last_selected.front().lock();
+                       }
                } else {
                        _first_selected_stripable = boost::weak_ptr<Stripable>();
                }