summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cogl/cogl/cogl-trace.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/cogl/cogl/cogl-trace.c b/cogl/cogl/cogl-trace.c
index 1e2d3abcf..73c768346 100644
--- a/cogl/cogl/cogl-trace.c
+++ b/cogl/cogl/cogl-trace.c
@@ -60,6 +60,13 @@ cogl_trace_context_new (int fd)
}
static void
+cogl_trace_context_free (CoglTraceContext *trace_context)
+{
+ g_clear_pointer (&trace_context->writer, sysprof_capture_writer_unref);
+ g_free (trace_context);
+}
+
+static void
ensure_trace_context (int fd)
{
g_mutex_lock (&cogl_trace_mutex);
@@ -135,6 +142,9 @@ disable_tracing_idle_callback (gpointer user_data)
g_mutex_lock (&cogl_trace_mutex);
trace_context = cogl_trace_context;
sysprof_capture_writer_flush (trace_context->writer);
+
+ g_clear_pointer (&cogl_trace_context, cogl_trace_context_free);
+
g_mutex_unlock (&cogl_trace_mutex);
return G_SOURCE_REMOVE;