Paul Davis
bc7f25e52c
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. |
||
---|---|---|
.. | ||
boost-debug | ||
msvc | ||
MSVCpbd | ||
pbd | ||
test | ||
base_ui.cc | ||
basename.cc | ||
boost_debug.cc | ||
cartesian.cc | ||
ChangeLog | ||
cocoa_open_uri.mm | ||
command.cc | ||
configuration_variable.cc | ||
controllable.cc | ||
convert.cc | ||
COPYING | ||
cpus.cc | ||
crossthread.cc | ||
crossthread.posix.cc | ||
crossthread.win.cc | ||
debug_rt_alloc.c | ||
debug.cc | ||
demangle.cc | ||
downloader.cc | ||
enums.cc | ||
enumwriter.cc | ||
epa.cc | ||
error.cc | ||
event_loop.cc | ||
ffs.cc | ||
file_archive.cc | ||
file_utils.cc | ||
fpu.cc | ||
glib_event_source.cc | ||
id.cc | ||
inflater.cc | ||
libpbd.pc.in | ||
libpbd.spec.in | ||
locale_guard.cc | ||
localtime_r.cc | ||
malign.cc | ||
md5.cc | ||
microseconds.cc | ||
mountpoint.cc | ||
openuri.cc | ||
pathexpand.cc | ||
pbd.cc | ||
pcg_rand.cc | ||
pool.cc | ||
progress.cc | ||
property_list.cc | ||
pthread_utils.cc | ||
reallocpool.cc | ||
receiver.cc | ||
resource.cc | ||
run-tests.sh | ||
search_path.cc | ||
semutils.cc | ||
shortpath.cc | ||
signals.cc | ||
spinlock.cc | ||
stacktrace.cc | ||
stateful_diff_command.cc | ||
stateful.cc | ||
string_convert.cc | ||
strreplace.cc | ||
strsplit.cc | ||
system_exec.cc | ||
textreceiver.cc | ||
timer.cc | ||
timing.cc | ||
tlsf.cc | ||
transmitter.cc | ||
undo.cc | ||
utf8_utils.cc | ||
uuid.cc | ||
whitespace.cc | ||
windows_mmcss.cc | ||
windows_special_dirs.cc | ||
windows_timer_utils.cc | ||
wscript | ||
xml++.cc |