ardour/libs
Paul Davis bc7f25e52c libpbd: AbstractUI must call & destroy sigc::trackable callbacks in its destructor
AbstractUI IS-A BaseUI IS-A EventLoop
                       IS-A sigc::trackable

If we have sent a call_slot() request to an EventLoop that has not executed
when the object involved in the call_slot() functor is destroyed, we need to
ensure that the request is invalidated.

To do this, We register "notify" callbacks with the sigc::trackable that is a
base class of the object involved in the functor given to
call_slot(). sigc::trackable will call these "notify" callbacks from its
destructor.

So when the call_slot() functor's relevant object dies, and its sigc::trackable
base class is destroyed, it will invoke all of its the "notify" callbacks, which will
in turn call EventLoop::invalidate_request() and this hopefully marks all the
queued call_slot() functors as "do not call".

However, invalidate_request() requires a lock, and access to the lock is
granted via a pure virtual, EventLoop::slot_invalidation_lock(). In the
heirarchy cited above, this is implemented by AbstractUI.

When we destroy an AbstractUI, ~AbstractUI() is called first, and this destroys
the lock and changes the VTT so that ::slot_invalidation_lock() becomes a pure
virtual again.

Eventually we will call ~trackable() which in turns runs all the "notify"
callbacks, and then removes them. But when these callbacks end up in
EventLoop::invalidate_request(), we try to call ::slot_invalidation_lock() and
C++ will abort because of its (now) pure virtual status.

Therefore, we must invoke the "notify" callbacks before the
::slot_invalidation_lock() becomes pure, and that means inside ~AbstractUI, as
an explicit call to trackable::notify_callbacks().

This has not appeared before (remarkably), but became an issue when the
Launchpad Pro support code's main object (derived from MIDISurface and hence
from AbstractUI) "failed" to use sub-objects for its various methods. So when
it connects to, for example, the Session::RouteAddedOrRemoved signal, it is
connecting itself (derived from a sigc::trackable). When the Launchpad Pro
object is destroyed, it tries to invalidate all the call_slot() requests, but
this requires access to an event loop lock - owned by the Launchpad Pro event
loop, which is already destroyed!

Other surfaces have generally avoided this by using other objects to provide
methods of dealing with signals from libardour objects.
2023-08-30 16:06:14 -06:00
..
appleutility wscript: drop unnecessary trailing ";" 2022-04-09 12:16:41 +02:00
ardour libpbd: change static trigger property change signal to take Trigger* 2023-08-30 16:06:13 -06:00
ardouralsautil ALSA: disambiguate multiple soundcards with the same name 2023-07-02 00:17:58 +02:00
audiographer Fix shaped dither (#9342) 2023-05-22 04:50:19 +02:00
auscan Change tools --help URLs to use https 2022-10-24 04:57:30 +02:00
backends Amend d899441df1, fix duplicate device map entries 2023-07-03 19:57:55 +02:00
canvas fix off-by-one pixel error caused by using floor() instead of round() 2023-08-26 10:07:41 -06:00
clearlooks-newer wscript: drop configure statements already present in the top level wscript 2022-01-22 22:19:03 +01:00
ctrl-interface midi surfaces: use an event loop invalidator for call_slot() 2023-08-30 16:06:14 -06:00
evoral domain swaps for MIDI CC and other controls 2023-08-16 09:06:10 -06:00
fluidsynth Fix invalid use of Doxygen "@param" command 2022-10-30 20:44:28 -04:00
fst Fix cross-compile linking (libusb - see also 5794d21a76) 2023-05-04 21:31:13 +02:00
gtkmm2ext libpbd/guis: move __invalidator() into PBD::EventLoop 2023-08-30 16:06:14 -06:00
hidapi wscript: drop configure statements already present in the top level wscript 2022-01-22 22:19:03 +01:00
libltc Fix various typos 2022-08-03 12:10:01 -06:00
lua Lua: allow to reserve STL vector size 2023-07-12 18:23:51 +02:00
midi++2 Fix various MMC commands, set request-source 2023-06-04 01:15:02 +02:00
panners switch from boost::{shared,weak}_ptr to std::{shared,weak}_ptr 2023-03-24 14:19:15 -06:00
pbd libpbd: AbstractUI must call & destroy sigc::trackable callbacks in its destructor 2023-08-30 16:06:14 -06:00
plugins Fix another lv2core header include 2023-05-07 01:41:01 +02:00
ptformat wscript: remove trailing whitespace 2022-04-09 12:16:37 +02:00
qm-dsp Address some Wmissing-prototypes in qm-dsp 2022-11-26 16:23:52 +01:00
surfaces lppro: get long press working, add undo/redo/metronome 2023-08-30 16:06:14 -06:00
temporal temporal: a guess at how to use BBT markers from within TempoMap::paste() 2023-08-30 15:21:55 -06:00
vamp-plugins Fix EBU-R128 loudness analysis for mono signals 2023-02-02 17:58:46 +01:00
vamp-pyin Fix typos 2022-09-21 19:09:55 -06:00
vfork Fix vfork wrapper for macOS 2023-03-25 07:46:47 +01:00
vst3 Ignore Steinberg's non-virtual-d'tor 2023-02-08 02:03:54 +01:00
waveview switch from glib atomic to std::atomic (libs edition) 2023-03-24 14:19:15 -06:00
widgets ArdourCtrlBase should pass UseGroup when setting control values 2023-07-27 13:28:02 -06:00
zita-convolver wscript: drop configure statements already present in the top level wscript 2022-01-22 22:19:03 +01:00
zita-resampler zita-resampler: pass-through data if not configured 2022-05-24 20:41:59 +02:00