13
0
livetrax/libs/pbd/pbd
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
..
abstract_ui.cc libpbd: AbstractUI must call & destroy sigc::trackable callbacks in its destructor 2023-08-30 16:06:14 -06:00
abstract_ui.h surfaces & event loops: i really mean no more request buffer factories 2023-04-21 13:55:58 -06:00
assert.h fix actual x_assert macro definition 2022-06-22 13:31:08 -06:00
atomic_counter.h std::atomic - 2nd batch of changes to convert from glib to std::atomic 2023-03-24 14:19:15 -06:00
atomic.h switch from glib atomic to std::atomic (libs edition) 2023-03-24 14:19:15 -06:00
base_ui.h (re)add mechanism for a callback in any glib event loop executed before the loop "executes" 2022-05-16 15:24:52 -06:00
basename.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
boost_debug.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
cartesian.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
command.h pbd: fairly unconscionable that Command in libpbd is not namespaced, so now it is 2023-08-07 16:33:16 -06:00
compose.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
configuration_variable.h Constification: make Stateful::get_state() const, with all other required const-ness added (libs) 2022-04-06 21:56:59 -06:00
configuration.h class 'PBD::Configuration' now needs to be exportable 2023-01-28 17:44:11 +00:00
control_math.h Short-circuit gain interpolation if the change is negligibly small 2020-07-21 18:37:32 -05:00
controllable.h switch from boost::{shared,weak}_ptr to std::{shared,weak}_ptr 2023-03-24 14:19:15 -06:00
convert.h add upcase() method; remove upcase version of internationalize() 2023-01-27 15:13:27 -07:00
cpus.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
crossthread.h Fix a few hundred doxygen warnings.. 2019-09-30 04:45:59 +02:00
debug_rt_alloc.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
debug.h extend PBD::Debug API to provide a method that doesn't send to debug Transmitter 2023-08-30 16:06:13 -06:00
demangle.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
destructible.h Allow to use Destructible as virtual base class 2022-04-14 16:35:02 +02:00
downloader.h downloader: remove unnecessary header 2022-09-13 14:15:24 -06:00
enum_convert.h gcc 6.x requires <typeinfo> for typeid, it seems 2021-08-13 12:51:29 -06:00
enumwriter.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
epa.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
error.h Add debug transmitter 2020-10-13 21:27:16 +02:00
event_loop.h libpbd/guis: move __invalidator() into PBD::EventLoop 2023-08-30 16:06:14 -06:00
failed_constructor.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
fastlog.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
ffs.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
file_archive.h Implement FileArchive progress/cancel 2023-05-19 03:08:22 +02:00
file_utils.h Fix use of doxygen documented parameters in running text 2019-09-30 06:30:11 +02:00
floating.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
fpu.h Add CPU detection 2023-02-04 23:07:17 +01:00
functor_command.h pbd: fairly unconscionable that Command in libpbd is not namespaced, so now it is 2023-08-07 16:33:16 -06:00
gettext.h Update and consolidate gettext.h 2022-09-07 00:09:54 +02:00
glib_event_source.h libpbd: change GlibEventLoopCallback to use C API not C++ 2022-05-19 22:24:43 -06:00
gstdio_compat.h Update tracker/reference URLs to prefer HTTPs 2022-10-24 04:59:20 +02:00
i18n.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
id.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
inflater.h Implement FileArchive progress/cancel 2023-05-19 03:08:22 +02:00
int62.h int62_t: use explicit memory order for all loads and stores 2023-03-24 14:19:15 -06:00
integer_division.h Fix 128 bit integer math rounding (#9057) 2023-01-12 16:08:53 +01:00
libpbd_visibility.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
locale_guard.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
localtime_r.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
malign.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
match.h move match_search_strings() function from plugin utils to PBD 2023-01-22 17:41:43 -07:00
mathfix.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
md5.h NOOP, remove trailing tabs/whitespace. 2015-10-05 16:17:49 +02:00
memento_command.h pbd: fairly unconscionable that Command in libpbd is not namespaced, so now it is 2023-08-07 16:33:16 -06:00
microseconds.h change PBD::microseconds_t to a signed type and check for -1 in TimingStats::update 2021-06-28 14:47:48 -06:00
mountpoint.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
mpmc_queue.h std::atomic - 2nd batch of changes to convert from glib to std::atomic 2023-03-24 14:19:15 -06:00
msvc_pbd.h Accommodate some changes to 'ssize_t' in VS2019 2021-05-11 14:06:25 +01:00
natsort.h Implement natural-sort spaceship operator 2021-10-08 04:12:32 +02:00
openuri.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
pathexpand.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
pbd.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
pcg_rand.h A few visibility changes needed for linking to libpbd (when building with MSVC) 2021-09-04 12:35:44 +01:00
playback_buffer.h std::atomic - 2nd batch of changes to convert from glib to std::atomic 2023-03-24 14:19:15 -06:00
pool.h Place Pool in PBD namespace 2022-07-07 05:21:54 +02:00
progress.h Move Ardour::Progress to PBD::Progress 2023-05-19 00:35:20 +02:00
properties.h more functional tempo mapping 2023-03-24 14:19:16 -06:00
property_basics_impl.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
property_basics.h libpbd: add operator<< for PropertyChange 2023-08-30 16:06:13 -06:00
property_list_impl.h Insert_or_assign properties, allow to override properties 2022-10-07 00:32:14 +02:00
property_list.h Insert_or_assign properties, allow to override properties 2022-10-07 00:32:14 +02:00
pthread_utils.h Allow to override default stack limit for background processes 2022-11-13 03:01:57 +01:00
rcu.h Make RCU reader return a const pointer (omnibus commit) 2023-04-08 00:15:37 +02:00
reallocpool.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
receiver.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
replace_all.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
resource.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
ringbuffer.h switch from glib atomic to std::atomic (libs edition) 2023-03-24 14:19:15 -06:00
ringbufferNPT.h std::atomic - 2nd batch of changes to convert from glib to std::atomic 2023-03-24 14:19:15 -06:00
scoped_file_descriptor.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
search_path.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
selectable.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
semutils.h Improve PBD::Semaphore performance 2022-05-12 05:27:27 +02:00
sequence_property.h pbd: fairly unconscionable that Command in libpbd is not namespaced, so now it is 2023-08-07 16:33:16 -06:00
shortpath.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
signals.h libpbd: provide access from a ScopedConnection to the underlying UnscopedConnection 2023-04-21 12:16:37 -06:00
signals.py libpbd: fix return type of Signal<>::size() 2023-04-21 12:16:37 -06:00
spinlock.h Another try at C++11/boost spinlock initialization 2019-09-26 02:48:17 +02:00
stack_allocator.h Fix MacOS 10.11 (clang-8.0.0) builds 2020-03-09 18:33:11 +01:00
stacktrace.h fix signed/unsigned warning 2022-06-21 17:31:50 -06:00
stateful_diff_command.h pbd: fairly unconscionable that Command in libpbd is not namespaced, so now it is 2023-08-07 16:33:16 -06:00
stateful.h pbd: fairly unconscionable that Command in libpbd is not namespaced, so now it is 2023-08-07 16:33:16 -06:00
statefuldestructible.h Allow to use Destructible as virtual base class 2022-04-14 16:35:02 +02:00
stl_delete.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
stl_functors.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
string_convert.h miscellaneous fixes for warnings from -Wconversion 2022-07-04 22:01:48 -06:00
strsplit.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
system_exec.h Allow to unset LD_LIBRARY_PATH on exec 2022-04-01 18:19:55 +02:00
textreceiver.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
thrown_error.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
timer.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
timersub.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
timing.h miscellaneous fixes for warnings from -Wconversion 2022-07-04 22:01:48 -06:00
tlsf.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
tokenizer.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
touchable.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
transmitter.h Add debug transmitter 2020-10-13 21:27:16 +02:00
types_convert.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
undo.h next iteration of changes to handle time domain bounces as undoable 2023-08-14 23:42:08 -06:00
unknown_type.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
unwind.h add new exception-safe RAII object, that increments/decrements its argument 2022-06-13 10:51:04 -06:00
utf8_utils.h Add API to sanitize UTF-8 strings 2023-04-26 17:25:24 +02:00
uuid_boost.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
uuid.h Update core library GPL boilerplate and (C) from git log 2019-08-03 15:53:17 +02:00
whitespace.h libpbd: fix decl of remove_extra_whitespaces 2022-09-07 17:56:52 -06:00
win_console.h Fix compilation with mingw/gcc-8 2020-12-10 20:21:29 +01:00
windows_mmcss.h Some initial changes (currently for libpbd only) to help a new contributer who's trying to build with MSVC2017 2020-03-26 10:40:36 +00:00
windows_special_dirs.h Extend convenience API to query windows registry 2020-10-30 13:15:06 +01:00
windows_timer_utils.h put get_microseconds() into PBD namsepace 2021-06-26 18:25:02 -06:00
xml++.h switch from boost::{shared,weak}_ptr to std::{shared,weak}_ptr 2023-03-24 14:19:15 -06:00