xdg_mime_init isn't called by xdg_mime_list_mime_parents
Submitted by Luca Wehrstedt
Assigned to Jonathan Blandford Blandford @jrb
Description
xdg_mime_init is supposed to be called by all public functions before they start "doing" something. Actually, the following ones don't:
xdg_mime_is_valid_mime_type xdg_mime_media_type_equal xdg_mime_list_mime_parents xdg_mime_shutdown xdg_mime_register_reload_callback xdg_mime_remove_callback
I think that, at least, _list_mime_parents should call it because otherwise calling _list_mime_parents for the first time (without having called any other public function before) always returns NULL instead of the correct result (which may be different).
This is because _list_mime_parents checks if caches are present. They aren't (since nothing has been loaded yet) and it fallbacks on _get_mime_parents, which calls _init. If caches are present, _init loads them and doesn't load parent_list. So _get_mime_parents finds an empty list and returns NULL. Subsequent calls to _list_mime_parents will succeed since now the caches have been loaded.
It's trivial to fix so I'm not attaching a patch.