clear up some CSS padding/margin confusion, and add row/col spacing
[ardour.git] / libs / pbd / event_loop.cc
index ea3f7a46afb5ae2b347967169c8ace80e69afc6a..e003a8d37a0ccaa635c6c8eab757dbdc939d326f 100644 (file)
@@ -45,6 +45,18 @@ EventLoop::EventLoop (string const& name)
 {
 }
 
+EventLoop::~EventLoop ()
+{
+       trash.sort();
+       trash.unique();
+       for (std::list<InvalidationRecord*>::iterator r = trash.begin(); r != trash.end(); ++r) {
+               if (!(*r)->in_use ()) {
+                       delete *r;
+               }
+       }
+       trash.clear ();
+}
+
 EventLoop*
 EventLoop::get_event_loop_for_thread()
 {
@@ -60,7 +72,7 @@ EventLoop::set_event_loop_for_thread (EventLoop* loop)
 void*
 EventLoop::invalidate_request (void* data)
 {
-        InvalidationRecord* ir = (InvalidationRecord*) 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
@@ -86,16 +98,14 @@ EventLoop::invalidate_request (void* data)
         * inherit (indirectly) from sigc::trackable.
         */
 
-        if (ir->event_loop) {
+       if (ir->event_loop) {
+               DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: EventLoop::invalidate_request %2\n", ir->event_loop, ir));
                Glib::Threads::Mutex::Lock lm (ir->event_loop->slot_invalidation_mutex());
-               for (list<BaseRequestObject*>::iterator i = ir->requests.begin(); i != ir->requests.end(); ++i) {
-                       (*i)->valid = false;
-                       (*i)->invalidation = 0;
-               }
-               delete ir;
-        }
+               ir->invalidate ();
+               ir->event_loop->trash.push_back(ir);
+       }
 
-        return 0;
+       return 0;
 }
 
 vector<EventLoop::ThreadBufferMapping>