GNOME Bugzilla – Bug 624504
[0.11] [bus] Remove gst_bus_poll()
Last modified: 2012-09-25 00:11:27 UTC
It should not be used since it runs the main loop from non main thread. Here is the relevant part of backtrace:
+ Trace 222861
Well, gst_bus_poll() simply shouldn't run a main loop on the default context. Patch coming soon
Created attachment 166004 [details] [review] bus: Don't use the default main context in gst_bus_poll() Otherwise we might call run a nested main loop in the default main context, which will confuse GTK+ and other users of the default main context. Fixes bug #624504.
The patch looks good, but there is also Bug #615655 for camerabin (shouldn't rely on running GLib main loop).
Yes, that's a separate problem though... and very easy to fix.
I don't think we can change this now. This behaviour was at the time regarded as a feature, not a bug, and the problems with it are well-documented in the gst_bus_poll() API documentation. Use gst_bus_timed_pop_filtered() if you want blocking behaviour without iterating the default main loop.
Right, applications might assume that gst_bus_poll() runs their mainloop... maybe we should deprecate it and get it removed in 0.11 and add a gst_bus_poll_full() that takes a main context as argument?
I wouldn't mind if we deprecated it, but I'm not really sure if a _full() variant with main context is a better idea, because it doesn't solve the fundamental problem with this kind of function and still encourages bad code design which *will* lead to obscure bugs in corner cases.
Ok, then we should remove gst_bus_poll() in 0.11 ;)
Created attachment 169534 [details] [review] deprecate gst_bus_poll() This patch deprecates gst_bus_poll() and replaces it in the tests/examples with gst_bus_timed_pop_filtered(). You'd think we would have avoided using a function in examples that is documented as "You should never use this function, since it is pure evil." The tests pass, but I'm not entirely clear on the consequences of simply replacing gst_bus_poll() as I did. Hopefully someone else can comment.
I don't really think deprecating it now is a good idea. It's used in a lot of applications and getting a "wait for messages but let the mainloop continue" manually everywhere is not that easy.
We still have gst_bus_poll in 0.11.