Don't allow to add/remove monitor-section w/o engine
[ardour.git] / libs / ardour / session.cc
index ad2f04af61fd620c054269f0bc04cee025e0c2c9..ae354646b97885b414437c4a34ee621ff107efd5 100644 (file)
@@ -1161,6 +1161,12 @@ Session::remove_monitor_section ()
                return;
        }
 
+       /* allow deletion when session is unloaded */
+       if (!_engine.running() && !(_state_of_the_state & Deletion)) {
+               error << _("Cannot remove monitor section while the engine is offline.") << endmsg;
+               return;
+       }
+
        /* force reversion to Solo-In-Place */
        Config->set_solo_control_is_listen_control (false);
 
@@ -1217,6 +1223,11 @@ Session::add_monitor_section ()
 {
        RouteList rl;
 
+       if (!_engine.running()) {
+               error << _("Cannot create monitor section while the engine is offline.") << endmsg;
+               return;
+       }
+
        if (_monitor_out || !_master_out || Profile->get_trx()) {
                return;
        }