Reap invalidation records
authorRobin Gareus <robin@gareus.org>
Fri, 20 Jan 2017 12:46:11 +0000 (13:46 +0100)
committerRobin Gareus <robin@gareus.org>
Fri, 20 Jan 2017 12:54:03 +0000 (13:54 +0100)
libs/pbd/event_loop.cc
libs/pbd/pbd/event_loop.h

index f72255dd7296b868c23e39016a7f6c7dd05f1e76..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()
 {
index 2b661a7e3571155d583a5f9317b51425b4f7ef42..5f1f1344dd4d2e091e15998893ef7c77d9991289 100644 (file)
@@ -47,7 +47,7 @@ class LIBPBD_API EventLoop
 {
 public:
        EventLoop (std::string const&);
-       virtual ~EventLoop() {}
+       virtual ~EventLoop();
 
        enum RequestType {
                range_guarantee = ~0