summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2018-08-10 22:06:30 -0300
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2019-05-31 11:57:07 -0300
commit53748e3da7f1cf83ea11642eb14789443109b61e (patch)
tree94256d65963206e569b647c28d80ff2ccc1e0624
parent17c5436f6ef6b6a1238816c08a12097e58c48979 (diff)
downloadmutter-53748e3da7f1cf83ea11642eb14789443109b61e.tar.gz
cogl-trace: Cleanup context after disabling
This allows running the Capture() method multiple times, with different arguments each time. https://gitlab.gnome.org/GNOME/mutter/merge_requests/197
-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;