atareao / tunnel-indicator

An Indicator for your ssh tunnels in for the GNOME Shell desktop
MIT License
10 stars 2 forks source link

Gtk.IconTheme.get_default() is null - Gnome 3.38 #2

Open jmcstone opened 3 years ago

jmcstone commented 3 years ago

Thanks for the extension it is a very nice idea. I just started using the extension and noticed that after rebooting the that icon no longer displayed in the top bar. The extension page says this is only good for Gnome 3.36 and I am on Gnome 3.38 - so, maybe this is due to the newer version of Gnome?

This is complete error message:

Nov 25 12:53:28 dev gnome-shell[6480]: JS ERROR: Extension tunnel-indicator@atareao.es: TypeError: Gtk.IconTheme.get_default() is null
_init@/home/jeff/.local/share/gnome-shell/extensions/tunnel-indicator@atareao.es/extension.js:65:27
enable@/home/jeff/.local/share/gnome-shell/extensions/tunnel-indicator@atareao.es/extension.js:298:23
_callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:167:32
loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:348:26
_loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:586:18
collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:28
_loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:565:19
_enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:595:18
_sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:626:18
init@resource:///org/gnome/shell/ui/extensionSystem.js:56:14
_initializeUI@resource:///org/gnome/shell/ui/main.js:269:22
start@resource:///org/gnome/shell/ui/main.js:159:5
@<main>:1:47

I was able to fix it by modifying the line which was causing the error from:

Gtk.IconTheme.get_default().append_search_path(
               Extension.dir.get_child('icons').get_path());

to:

    let defaultIconTheme = Gtk.IconTheme.get_default();
            if (defaultIconTheme) {
                 defaultIconTheme.append_search_path(
                     Extension.dir.get_child('icons').get_path());
             }

Additionally, since this code appeared to be related to icons I verified the icons on the help section and they all appeared to be working correctly.

There was another error message, that appeared very often, in the log files:

Object .Gjs_ui_popupMenu_PopupSwitchMenuItem (0x55776628d460), has been already deallocated — impossible to block any signal on it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.

The error was occurring on the following lines and appears to be related to this.TunnelSwitch being deallocated:

                GObject.signal_handlers_block_by_func(this.TunnelSwitch,
                                                      this._toggleSwitch);
                this.TunnelSwitch.setToggleState(active);
                GObject.signal_handlers_unblock_by_func(this.TunnelSwitch,
                                                      this._toggleSwitch);
                this.TunnelSwitch.label.set_text(msg);

I couldn't really determine what this.TunnelSwitch was doing so I removed all references to it the file - and, the extension seemed to behave normally (that is, 'normally' from my limited experience with this extension - lol).

Thanks again for the extension. Jeff

GustavAndreasson commented 3 years ago

This should be solved by #3