a better fix for CUE/TOC string escaping: if the text is not Latin-1 already, reject...
[ardour.git] / libs / ardour / session_events.cc
index 9c17c1cd12273dd1045815a1bd9aadb1ade4d56a..421c81d42cac7828793f8e7068a1074570fa9f80 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "pbd/error.h"
 #include "pbd/enumwriter.h"
+#include "pbd/stacktrace.h"
 
 #include "ardour/ardour.h"
 #include "ardour/audio_diskstream.h"
@@ -56,22 +57,37 @@ SessionEvent::create_per_thread_pool (const std::string& name, uint32_t nitems)
 }
 
 void *
-SessionEvent::operator new (size_t) 
+SessionEvent::operator new (size_t)
 {
        CrossThreadPool* p = pool->per_thread_pool ();
        SessionEvent* ev = static_cast<SessionEvent*> (p->alloc ());
-        cerr << "Allocating SessionEvent from " << p->name() << " ev @ " << ev << endl;
+       DEBUG_TRACE (DEBUG::SessionEvents, string_compose ("%1 Allocating SessionEvent from %2 ev @ %3\n", pthread_self(), p->name(), ev));
+#ifndef NDEBUG
+       if (DEBUG::SessionEvents & PBD::debug_bits) {
+               stacktrace (cerr, 40);
+       }
+#endif
        ev->own_pool = p;
        return ev;
 }
-    
-void 
-SessionEvent::operator delete (void *ptr, size_t /*size*/) 
+
+void
+SessionEvent::operator delete (void *ptr, size_t /*size*/)
 {
        Pool* p = pool->per_thread_pool ();
        SessionEvent* ev = static_cast<SessionEvent*> (ptr);
 
-        cerr << "Deleting SessionEvent @ " << ev << " thread pool =  " << p->name() << " ev pool = " << ev->own_pool->name() << endl;
+       DEBUG_TRACE (DEBUG::SessionEvents, string_compose (
+                            "%1 Deleting SessionEvent @ %2 ev thread pool = %3 ev pool = %4\n",
+                            pthread_self(), ev, p->name(), ev->own_pool->name()
+                            ));
+
+#ifndef NDEBUG
+       if (DEBUG::SessionEvents & PBD::debug_bits) {
+               stacktrace (cerr, 40);
+       }
+#endif
+
        if (p == ev->own_pool) {
                p->release (ptr);
        } else {
@@ -117,7 +133,7 @@ SessionEventManager::dump_events () const
        }
        cerr << "Next event: ";
 
-        if ((Events::const_iterator) next_event == events.end()) {
+       if ((Events::const_iterator) next_event == events.end()) {
                cerr << "none" << endl;
        } else {
                cerr << "at " << (*next_event)->action_frame << ' '