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
This commit is contained in:
Georges Basile Stavracas Neto 2018-08-10 22:06:30 -03:00
parent 17c5436f6e
commit 53748e3da7
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385

View File

@ -59,6 +59,13 @@ cogl_trace_context_new (int fd)
return context;
}
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)
{
@ -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;