clear up some CSS padding/margin confusion, and add row/col spacing
[ardour.git] / libs / pbd / event_loop.cc
index a1b3670a6870964d51389228e5fd86406c020780..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()
 {
@@ -87,15 +99,10 @@ EventLoop::invalidate_request (void* data)
         */
 
        if (ir->event_loop) {
-               {
-                       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;
-                       }
-               }
-               // should this not always be deleted, regardless if there's an event_loop?
-               delete ir;
+               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());
+               ir->invalidate ();
+               ir->event_loop->trash.push_back(ir);
        }
 
        return 0;