summaryrefslogtreecommitdiff
path: root/libs/pbd/event_loop.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-04-24 16:45:38 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-04-24 16:45:38 +0000
commitd5e14b3d9144400fb8026fb9783a5a8582c0ad87 (patch)
tree9c74ea0c58f80a58c5d9e9d52b26f09d34e677d3 /libs/pbd/event_loop.cc
parent9b8fe0b09fb62fd96e21e219b916e3b61fab0150 (diff)
eventloop and abstractui debugging, lots more commenting on abstractui/eventloop implementation; minor tweaks elsewhere
git-svn-id: svn://localhost/ardour2/branches/3.0@12076 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/event_loop.cc')
-rw-r--r--libs/pbd/event_loop.cc27
1 files changed, 24 insertions, 3 deletions
diff --git a/libs/pbd/event_loop.cc b/libs/pbd/event_loop.cc
index 5a9a220075..5c132037d3 100644
--- a/libs/pbd/event_loop.cc
+++ b/libs/pbd/event_loop.cc
@@ -20,14 +20,35 @@ EventLoop::set_event_loop_for_thread (EventLoop* loop)
thread_event_loop.set (loop, do_not_delete_the_loop_pointer);
}
-/** Called when a sigc::trackable that was connected to using the invalidator() macro
- * is destroyed.
- */
void*
EventLoop::invalidate_request (void* data)
{
InvalidationRecord* ir = (InvalidationRecord*) data;
+ /* Some of the requests queued with an EventLoop may involve functors
+ * that make method calls to objects whose lifetime is shorter
+ * than the EventLoop's. We do not want to make those calls if the
+ * object involve has been destroyed. To prevent this, we
+ * provide a way to invalidate those requests when the object is
+ * destroyed.
+ *
+ * An object was passed to __invalidator() which added a callback to
+ * EventLoop::invalidate_request() to its "notify when destroyed"
+ * list. __invalidator() returned an InvalidationRecord that has been
+ * to passed to this function as data.
+ *
+ * The object is currently being destroyed and so we want to
+ * mark all requests involving this object that are queued with
+ * any EventLoop as invalid.
+ *
+ * As of April 2012, we are usign sigc::trackable as the base object
+ * used to queue calls to ::invalidate_request() to be made upon
+ * destruction, via its ::add_destroy_notify_callback() API. This is
+ * not necessarily ideal, but it is very close to precisely what we
+ * want, and many of the objects we want to do this with already
+ * inherit (indirectly) from sigc::trackable.
+ */
+
if (ir->event_loop) {
Glib::Mutex::Lock lm (ir->event_loop->slot_invalidation_mutex());
for (list<BaseRequestObject*>::iterator i = ir->requests.begin(); i != ir->requests.end(); ++i) {