GNOME Bugzilla – Bug 328423
[gnomevfs] doesn't handle case when gnomevfs can't init
Last modified: 2006-02-06 19:12:46 UTC
There are cases when gnomevfs can't init. Mostly this is if there is no ~/.gnome2 directory, and that directory can't be made. However our plugin doesn't check the return value of gnome_vfs_init(), just assuming that it succeeds. Either we: - call _init in the instance init, as we do now, and store the result in a variable that makes the plugin refuse to go to READY - call _init() in NULL->READY - call _init() in the plugin init - somehow make upstream not check for .gnome2 (why does it need it?) -- but it's possible there are other ways it can fail (e.g. bonobo) c.f. https://core.fluendo.com/flumotion/trac/ticket/278
One thing to keep in mind here is gst_element_make_from_uri() and how it goes by rank. If gnomevfssrc cannot be used because it fails to initialise for some reason, it would be good if another element with a lower rank was chosen for a specific uri. That's why I'd go for calling _init() in the plugin init function and setting a flag somewhere. If _init() fails, gnomevfssrc is registered with GST_RANK_NONE, otherwise it is registered with the original rank. In NULL => READY state change the flag is checked and state change fails if _init() failed earlier. Not registering the element at all when _init() fails can only lead to confusion IMHO.
Ah yes. Well I suppose the best is to return False from the plugin's init function, to indicate an error loading the plugin. That will prevent plugin registration, and therefore plugin instantiation.
Fixed as you suggested: 2006-02-06 Tim-Philipp Müller <tim at centricular dot net> * ext/gnomevfs/gstgnomevfs.c: (plugin_init): Return FALSE from plugin_init() when GnomeVFS can't be initialised for some reason (#328423).