After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 334587 - Possible crasher on startup
Possible crasher on startup
Status: RESOLVED FIXED
Product: nautilus-sendto
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Roberto Majadas
Roberto Majadas
: 327876 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-03-14 23:17 UTC by Bastien Nocera
Modified: 2006-04-06 16:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
nst-module-unload-crasher.patch (7.48 KB, patch)
2006-03-14 23:18 UTC, Bastien Nocera
none Details | Review

Description Bastien Nocera 2006-03-14 23:17:10 UTC
If libbtctl can't initialise the Bluetooth device, then nautilus-sendto will crash on startup (usually, while loading the interface).

The problem is that if libbtctl fails, it will create a new GQuark using g_quark_from_static_string. And the GModule documentation says:
"
If your module introduces static data to common subsystems in the running program, e.g. through calling g_quark_from_static_string ("my-module-stuff"), it must ensure that it is never unloaded, by calling g_module_make_resident().
"

So using g_module_close on the bluetooth plugin will remove a quark from a static string, and crash nautilus-sendto whenever another quark is registered.

The attached patch adds the "never_unload" struct member so that modules that say so can't be unloaded.

It also fixes:
- don't use home-made str_has_suffix, we have g_str_has_suffix
- use g_dir_open instead of opendir
- don't leak the plugins directory on startup
- mark as static functions that are not used anywhere else
- namespace the plugins so as to avoid clashes with system libraries, confusing the hell out of libtool (libbluetooth.so is the generated library, as well as the system bluetooth library)
- use GError properly in the bluetooth module
- Fix a couple of warnings in the evo plugin
Comment 1 Bastien Nocera 2006-03-14 23:18:00 UTC
Created attachment 61254 [details] [review]
nst-module-unload-crasher.patch
Comment 2 Bastien Nocera 2006-04-06 16:18:25 UTC
*** Bug 327876 has been marked as a duplicate of this bug. ***
Comment 3 Bastien Nocera 2006-04-06 16:37:22 UTC
2006-04-06  Bastien Nocera  <hadess@hadess.net>

        * src/nautilus-sendto-command.c: (nautilus_sendto_plugin_init):
        Use g_str_has_suffix instead of our home-made str_has_suffix, and
        use g_dir_open instead of opendir
        * src/plugins/Makefile.am: namespace the plugins so as to avoid
        clashes with system libraries, confusing the hell out of libtool
        (libbluetooth.so is the generated library, as well as the system
         bluetooth library)
        * src/plugins/bluetooth.c: (init): use GError properly
        * src/plugins/evolution.c: (add_evolution_contacts_to_model): fix
        a compilation warning
        * src/plugins/gaim.c:
        * src/nautilus-sendto-plugin.h:
        Update the plugin struct to allow plugins not to be unloaded, fixes
        the crashes on startup when the bluetooth plugin fails to initialise
        (Closes: #334587)