Fix console1 crashes when no surface is present

e.g. selecting a track causes a ControlNotFoundException
if the ctrl surface is enabled, but no hardware is connected.

terminate called after throwing an instance of 'ArdourSurface::ControlNotFoundExceptio

```
#0  0x00007ffff14d8c2e in __cxa_throw () at /lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00007fffe2b560a0 in ArdourSurface::Console1::get_button(ArdourSurface::Console1::ControllerID) const (this=0x61d0017e1c80, id=ArdourSurface::Console1::FOCUS1)
    at ../libs/surfaces/console1/console1.cc:928
#2  0x00007fffe2bfc647 in ArdourSurface::Console1::map_select() (this=0x61d0017e1c80) at ../libs/surfaces/console1/c1_operations.cc:653
#3  0x00007fffe2b55384 in ArdourSurface::Console1::map_stripable_state() (this=0x61d0017e1c80) at ../libs/surfaces/console1/console1.cc:832
#4  0x00007fffe2b541ab in ArdourSurface::Console1::set_current_stripable(std::shared_ptr<ARDOUR::Stripable>)
...
```

This does at least fix the crash. Ideally the surface would
only be enabled if there is hardware present.
This commit is contained in:
Robin Gareus 2023-10-19 21:58:28 +02:00
parent 31f42b9be5
commit 8f5df7ed28
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
3 changed files with 30 additions and 30 deletions

View file

@ -337,7 +337,7 @@ Console1::spill_plugins (const int32_t plugin_index)
plugin_insert->ActiveChanged.connect (
plugin_connections, MISSING_INVALIDATOR, boost::bind (plugin_mapping), this);
plugin_insert->ActiveChanged ();
} catch (ControlNotFoundException&) {
} catch (ControlNotFoundException const&) {
DEBUG_TRACE (DEBUG::Console1, string_compose ("No ControllerButton found %1\n", n_controls));
}
PluginMappingMap::iterator pmmit = pluginMappingMap.find (plugin->unique_id ());
@ -409,7 +409,7 @@ Console1::spill_plugins (const int32_t plugin_index)
plugin_connections, MISSING_INVALIDATOR, boost::bind (plugin_mapping, _1, _2), this);
c->Changed (true, PBD::Controllable::GroupControlDisposition::UseGroup);
continue;
} catch (ControlNotFoundException&) {
} catch (ControlNotFoundException const&) {
DEBUG_TRACE (DEBUG::Console1, string_compose ("No Encoder found %1\n", n_controls));
}
} else {
@ -436,7 +436,7 @@ Console1::spill_plugins (const int32_t plugin_index)
plugin_connections, MISSING_INVALIDATOR, boost::bind (plugin_mapping, _1, _2), this);
c->Changed (true, PBD::Controllable::GroupControlDisposition::UseGroup);
continue;
} catch (ControlNotFoundException&) {
} catch (ControlNotFoundException const&) {
DEBUG_TRACE (DEBUG::Console1, string_compose ("No ControllerButton found %1\n", n_controls));
}
}