-static void
-trace_it (int addsub, void const* pn, void const* object, int use_count)
-{
- Glib::Mutex::Lock guard (the_lock);
- Backtrace* bt = new Backtrace (addsub, use_count, pn);
- TraceMap::iterator i = traces.find (const_cast<void*>(object));
-
- if (i == traces.end()) {
- pair<void const *,BacktraceList*> newpair;
- newpair.first = object;
- newpair.second = new BacktraceList;
- newpair.second->push_back (bt);
- traces.insert (newpair);
- cerr << "Start tracelist for " << object << endl;
- } else {
- i->second->push_back (bt);
- cerr << "Extend tracelist for " << object << endl;
- }
+static Glib::Threads::Mutex* _the_lock;
+static Glib::Threads::Mutex& the_lock() {
+ if (_the_lock == 0) {
+ _the_lock = new Glib::Threads::Mutex;
+ }
+ return *_the_lock;