[Bug 755554] gtk: Wait at most 5s for calling something on the main thread

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Thu Sep 24 10:37:16 PDT 2015


https://bugzilla.gnome.org/show_bug.cgi?id=755554

Nicolas Dufresne (stormer) <nicolas.dufresne at collabora.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #312076|none                        |needs-work
             status|                            |

--- Comment #2 from Nicolas Dufresne (stormer) <nicolas.dufresne at collabora.co.uk> ---
Review of attachment 312076:
 --> (https://bugzilla.gnome.org/review?bug=755554&attachment=312076)

::: ext/gtk/gstgtkbasesink.c
@@ +327,3 @@
+  gboolean timeout, ret;
+
+  ret = ! !gst_gtk_invoke_on_main ((GThreadFunc)

Was there before, but why would you want to use ! ! obscureness here, while you
can write readable code ?

::: ext/gtk/gstgtkutils.c
@@ +29,3 @@
   GCond cond;
   gboolean fired;
+  gboolean timed_out;

Consistency, timeout in basesink vs timed_out here.

@@ +52,3 @@
+    g_mutex_clear (&info->lock);
+    g_cond_clear (&info->cond);
+    g_free (info);

Using g_main_context_invoke_full() with a destroy notify would avoid the
duplication.

@@ +71,1 @@
+  info = g_new0 (struct invoke_context, 1);

Slice new please. I'd suggest having a new/free which will be clean with the
invoke_full(),

@@ +80,1 @@
+  g_main_context_invoke (main_context, (GSourceFunc) gst_gtk_invoke_func,
info);

Here.

@@ +91,3 @@
+      g_warning ("gtksink: Timed out to call something from the main thread");
+    *timeout = timed_out;
+    /* Leak everything on timeout */

The destroy notify will avoid the leak in a safe way.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list