X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=wrappers%2Fgltrace_state.cpp;h=68bda100354db46025c678618d3d66f2a9d6749e;hb=3801952b80cd7a7160f6410518f6e3740d461b60;hp=cb8e08b1accce6b7818a55528f74809f7da1cd53;hpb=5c298db8fe117e0a445af051335aa0da91c3a31b;p=apitrace diff --git a/wrappers/gltrace_state.cpp b/wrappers/gltrace_state.cpp index cb8e08b..68bda10 100644 --- a/wrappers/gltrace_state.cpp +++ b/wrappers/gltrace_state.cpp @@ -57,15 +57,13 @@ public: } }; -static os::thread_specific_ptr thread_state; +static thread_specific ThreadState *thread_state; static ThreadState *get_ts(void) { - ThreadState *ts = thread_state.get(); - + ThreadState *ts = thread_state; if (!ts) { - ts = new ThreadState; - thread_state.reset(ts); + thread_state = ts = new ThreadState; } return ts; @@ -115,12 +113,17 @@ bool releaseContext(uintptr_t context_id) void createContext(uintptr_t context_id) { + // wglCreateContextAttribsARB causes internal calls to wglCreateContext to be + // traced, causing context to be defined twice. + if (context_map.find(context_id) != context_map.end()) { + return; + } + context_ptr_t ctx(new Context); context_map_mutex.lock(); _retainContext(ctx); - assert(context_map.find(context_id) == context_map.end()); context_map[context_id] = ctx; context_map_mutex.unlock();