#include "pbd/error.h"
#include "pbd/stacktrace.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace PBD;
using namespace std;
{
}
+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()
{
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
* 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>
*/
ThreadBufferMapping mapping;
- Glib::Threads::RWLock::ReaderLock lm (thread_buffer_requests_lock);
+ Glib::Threads::RWLock::WriterLock lm (thread_buffer_requests_lock);
for (RequestBufferSuppliers::iterator trs = request_buffer_suppliers.begin(); trs != request_buffer_suppliers.end(); ++trs) {