GNOME Bugzilla – Bug 97948
libgstplay : GstPlay can not be unrefed with g_object_unref
Last modified: 2004-12-22 21:47:04 UTC
I tried something like this : void destroy_play (GstPlay * play) { g_return_val_if_fail (GST_IS_PLAY(play), FALSE); g_object_unref (play); return; } It throws a lot of errors like : GLib-GObject-WARNING **: invalid uninstantiatable type `(null)' in cast to `GObject' GLib-GObject-WARNING **: instance of invalid non-instantiatable type `<invalid>' GLib-GObject-CRITICAL **: file gsignal.c: line 2036 (g_signal_emit_valist): assertion `G_TYPE_CHECK_INSTANCE (instance)' failed Please help :) I need to be able to destroy GstPlay objects or 1GB RAM won't be enough to run my app
(Sorry if this is way out in left field, but I don't have a good way to test at the moment.) I have two questions/suggestions : 1. Don't calls like this commonly use an explicit cast to the proper object type ? Have you tried g_object_unref (G_OBJECT (play)); ? 2. Is play a GObject or GstObject ? I would suggest using gst_object_unref (GST_OBJECT (play)); if this object is in the GStreamer object hierarchy. Also, use a cast here as well.
I'd also suggest to not unref in the callback, but set a boolean and unref in an idler or something. Please reply to leif's suggestion as well, otherwise we'll close the bug.
So... GstPlay inherits from a GObject... the g_object_unref function works as expected the problem is somewherelse... Indeed when unrefing the GstPlay object a SIGSEGV is raised from a timetick function trying to access the GstPlay. The uninstantiable type errors are coming from this unrefed object that the timetick function tries to access.. I'll try to figure out how the unrefing function could destroy the threads that might be running which will try to access the GstPlay object later... Any help appreciated
Created attachment 13401 [details] [review] Patch fixing dispose methods and uncleaned callbacks
Ok Guys ... Here is the patch to solve those issues... I've changed a lot of stuff in libgstplay to clean the timers and idle handler that were launched and never cleaned... Now when i m unrefing the GstPlay object all callbacks are cleared, object disposed and no warning... Enjoy !