diff options
author | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2018-08-10 22:06:30 -0300 |
---|---|---|
committer | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2018-08-11 13:02:18 -0300 |
commit | 3b863393c8ff0c75f9def2907e929837878de6c9 (patch) | |
tree | 44a9d609f884a073d2664344612ecf2249708b2e | |
parent | 1d868fe601a49ca695373aad9a187cb9e5a3341b (diff) | |
download | mutter-gbsneto/tracing.tar.gz |
cogl-trace: Cleanup context after disablinggbsneto/tracing
This allows running the Capture() method multiple times,
with different arguments each time.
-rw-r--r-- | cogl/cogl/cogl-trace.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cogl/cogl/cogl-trace.c b/cogl/cogl/cogl-trace.c index eb536adf7..a8f6bf4b9 100644 --- a/cogl/cogl/cogl-trace.c +++ b/cogl/cogl/cogl-trace.c @@ -53,6 +53,13 @@ cogl_trace_context_new (int fd) } static void +cogl_trace_context_free (CoglTraceContext *trace_context) +{ + g_clear_pointer (&trace_context->writer, sp_capture_writer_unref); + g_free (trace_context); +} + +static void ensure_trace_context (int fd) { static GMutex mutex; @@ -128,6 +135,10 @@ disable_tracing_idle_callback (gpointer user_data) g_mutex_lock (&cogl_trace_mutex); trace_context = cogl_trace_context; sp_capture_writer_flush (trace_context->writer); + + g_clear_pointer (&cogl_trace_context, + (GDestroyNotify) cogl_trace_context_free); + g_mutex_unlock (&cogl_trace_mutex); return G_SOURCE_REMOVE; |