<div dir="ltr">Greeting, all<div><br></div><div style>I'm currently working on a app. But I'm now confronting a crash while repeatedly creating a pipeline very quickly. And I found that it was caused by a gst_bus_add_watch (<a href="http://pastebin.com/b2DVmHnQ">http://pastebin.com/b2DVmHnQ</a>). The code in <b><font color="#000000">gst_bus_add_watch_full_unlocked</font></b> was trying to creating a new GSource by calling <b>gst_bus_create_watch</b>, yet it turned out a NULL source. This is the final end point of the cause. And the code in <i>gstbus.c</i> looks like this:</div>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style><div style><font color="#666666">static guint</font></div></div><div style><div style><font color="#666666"><b>gst_bus_add_watch_full_unlocked</b> (GstBus * bus, gint priority,</font></div>
</div><div style><div style><font color="#666666"> GstBusFunc func, gpointer user_data, GDestroyNotify notify)</font></div></div><div style><div style><font color="#666666">{</font></div></div><div style><div style><font color="#666666"> GMainContext *ctx;</font></div>
</div><div style><div style><font color="#666666"> guint id;</font></div></div><div style><div style><font color="#666666"> GSource *source;</font></div></div><div style><div style><font color="#666666"><br></font></div>
</div><div style><div style><font color="#666666"> if (bus->priv->watch_id) {</font></div></div><div style><div style><font color="#666666"> GST_ERROR_OBJECT (bus,</font></div></div><div style><div style><font color="#666666"> "Tried to add new watch while one was already there");</font></div>
</div><div style><div style><font color="#666666"> return 0;</font></div></div><div style><div style><font color="#666666"> }</font></div></div><div style><div style><font color="#666666"><br></font></div></div><div style>
<div style><font color="#666666"> <b>source</b> = </font><b><font color="#444444">gst_bus_create_watch</font></b><font color="#666666"> (bus);</font></div></div><div style><div style><font color="#666666"><br></font></div>
</div><div style><div style><font color="#666666"> if (priority != G_PRIORITY_DEFAULT)</font></div></div><div style><div style><font color="#666666"> g_source_set_priority (<b>source</b>, priority);</font></div></div>
<div style><div style><font color="#666666"><br></font></div></div><div style><div style><font color="#666666"> g_source_set_callback (<b>source</b>, (GSourceFunc) func, user_data, notify);</font></div></div><div style>
<div style>
<font color="#666666"><br></font></div></div><div style><div style><font color="#666666"> ctx = g_main_context_get_thread_default ();</font></div></div><div style><div style><font color="#666666"> id = g_source_attach (source, ctx);</font></div>
</div><div style><div style><font color="#666666"> g_source_unref (source);</font></div></div><div style><div style><font color="#666666"><br></font></div></div><div style><div style><font color="#666666"> if (id) {</font></div>
</div><div style><div style><font color="#666666"> bus->priv->watch_id = source;</font></div></div><div style><div style><font color="#666666"> }</font></div></div><div style><div style><font color="#666666"><br>
</font></div></div><div style><div style><font color="#666666"> GST_DEBUG_OBJECT (bus, "New source %p with id %u", source, id);</font></div></div><div style><div style><font color="#666666"> return id;</font></div>
</div><div style><div style><font color="#666666">}</font></div></div></blockquote><div style><br></div><div style>And the client code from my app looks like this:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">
<div style><div style><font color="#666666"> worker->pipeline = workerclass->create_pipeline (worker);</font></div></div><div style><div style><font color="#666666"> if (!worker->pipeline)</font></div></div><div style>
<div style><font color="#666666"> goto error_create_pipeline;</font></div></div><div style><div style><font color="#666666"><br></font></div></div><div style><div style><font color="#666666"> gst_pipeline_set_auto_flush_bus (GST_PIPELINE (worker->pipeline), FALSE);</font></div>
</div><div style><div style><font color="#666666"><br></font></div></div><div style><div style><font color="#666666"> worker->bus = gst_pipeline_get_bus (GST_PIPELINE (worker->pipeline));</font></div></div><div style>
<div style><font color="#666666"> worker->watch = <b>gst_bus_add_watch</b> (worker->bus, gst_worker_message, worker);</font></div></div></blockquote><div style><div><br></div></div><div style>Part of the stack when it crashed is like this:</div>
<blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div style><div style><font color="#666666">#0 0x00007ffff728ef56 in </font><font color="#444444"><b>g_source_attach</b></font><font color="#666666"> () from /lib/x86_64-linux-gnu/libglib-2.0.so.0</font></div>
</div><div style><div style><font color="#666666">#1 0x00007ffff7b1e228 in </font><b><font color="#444444">gst_bus_add_watch_full_unlocked</font></b><font color="#666666"> (notify=<optimized out>, user_data=0x7fffc801a0c0, func=0x403d50 <gst_worker_message>, priority=<optimized out>, bus=<optimized out>) at gstbus.c:867</font></div>
</div><div style><div style><font color="#666666">#2 gst_bus_add_watch_full_unlocked (bus=<optimized out>, priority=<optimized out>, func=0x403d50 <gst_worker_message>, user_data=0x7fffc801a0c0, notify=<optimized out>) at gstbus.c:846</font></div>
</div><div style><div style><font color="#666666">#3 0x00007ffff7b1e367 in gst_bus_add_watch_full (bus=0x991c10, priority=priority@entry=0, func=func@entry=0x403d50 <gst_worker_message>, user_data=user_data@entry=0x7fffc801a0c0, notify=notify@entry=0x0) at gstbus.c:916</font></div>
</div><div style><div style><font color="#666666">#4 0x00007ffff7b1e390 in </font><b><font color="#444444">gst_bus_add_watch</font></b><font color="#666666"> (bus=<optimized out>, func=func@entry=0x403d50 <gst_worker_message>, user_data=user_data@entry=0x7fffc801a0c0) at gstbus.c:948</font></div>
</div><div style><div style><font color="#666666">#5 0x00000000004041b1 in gst_worker_prepare (worker=0x7fffc801a0c0) at gstworker.c:480</font></div></div></blockquote><div style><div><br></div><div style>Do you have any ideas about this? I've been tracking on it for long time, still have no lucks.</div>
<div style><br></div><div style>Regards</div><div style>Duzy Chan</div></div><div style><br></div></div>