Gnome-shell-system-monitor-applet: Tried to construct an object without a GType; are you using GObject.registerClass() when inheriting from a GObject type?

Created on 9 Apr 2020  路  12Comments  路  Source: paradoxxxzero/gnome-shell-system-monitor-applet

In the logging I found:

Apr 9 10:04:07 surfplank2 journal[58232]: JS WARNING: [/home/udo/.local/share/gnome-shell/extensions/[email protected]/extension.js 635]: Tried to construct an object without a GType; are you using GObject.registerClass() when inheriting from a GObject type?
(many of these)

Can you please fix this?
(Fedora 31, git mesa, git xf86-video-amdgpu, kernel.org 5.6.2)

Most helpful comment

Thanks to https://extensions.gnome.org/accounts/profile/Dario.Lesca try this version, it worked for me,

wget https://raw.githubusercontent.com/paradoxxxzero/gnome-shell-system-monitor-applet/fac6b7646346264bd75813a9d606dd5ba5152d6b/system-monitor%40paradoxxx.zero.gmail.com/extension.js -O ~/.local/share/gnome-shell/extensions/[email protected]/extension.js

Now just need to figure out what is happening in this version that isn't happening in newer versions

All 12 comments

Getting this too on Debian testing, Gnome 3.34.2,
Weird because after upgrading from stable -> testing, the extension was still working. It was only when Gnome told me to update it that it stopped working. I tried installing older versions like for 3.32 and 3.30 but got the same error.

Apr 13 17:38:58 throne gnome-shell[1455]: [System monitor] applet init from /home/scar/.local/share/gnome-shell/extensions/[email protected]
Apr 13 17:38:58 throne gnome-shell[1455]: JS ERROR: Extension [email protected]: Error: Tried to construct an object without a GType; are you using GObject.registerClass() when inheriting from a GObject type?#012SystemMonitor_TipItem@/home/scar/.local/share/gnome-shell/extensions/[email protected]/extension.js:669:13#012tip_format@/home/scar/.local/share/gnome-shell/extensions/[email protected]/extension.js:946:27#012SystemMonitor_Cpu@/home/scar/.local/share/gnome-shell/extensions/[email protected]/extension.js:1241:14#012createCpus@/home/scar/.local/share/gnome-shell/extensions/[email protected]/extension.js:1408:20#012enable@/home/scar/.local/share/gnome-shell/extensions/[email protected]/extension.js:2341:26#012_callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:148:32#012loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:280:26#012_loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:490:18#012collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:17#012_loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:469:19#012_enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:499:18#012_sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:530:18#012init@resource:///org/gnome/shell/ui/extensionSystem.js:48:14#012_initializeUI@resource:///org/gnome/shell/ui/main.js:242:22#012start@resource:///org/gnome/shell/ui/main.js:138:5#012@<main>:1:47

Thanks to https://extensions.gnome.org/accounts/profile/Dario.Lesca try this version, it worked for me,

wget https://raw.githubusercontent.com/paradoxxxzero/gnome-shell-system-monitor-applet/fac6b7646346264bd75813a9d606dd5ba5152d6b/system-monitor%40paradoxxx.zero.gmail.com/extension.js -O ~/.local/share/gnome-shell/extensions/[email protected]/extension.js

Now just need to figure out what is happening in this version that isn't happening in newer versions

I updated from git yesterday or so but I still saw the message.
So I updated from git again, restarted gnome-shell
And now we see:
Some code called array.toString() on a Uint8Array instance. Previously this would have interpreted the bytes of the array as a string, but that is nonstandard. In the future this will return the bytes as comma-separated digits. For the time being, the old behavior has been preserved, but please fix your code anyway to explicitly call ByteArray.toString(array).#012(Note that array.toString() may have been called implicitly.)#0120 cb() ["/home/udo/.local/share/gnome-shell/extensions/[email protected]/extension.js":1543]
Also:

Usage of object.actor is deprecated for PanelMenuButton#012get@resource:///org/gnome/shell/ui/environment.js:249:29#012enable@/home/udo/.local/share/gnome-shell/extensions/[email protected]/extension.js:2371:13#012_callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:148:13#012loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:280:21#012_loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:490:13#012collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:17#012_loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:469:9#012_enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:499:13#012_sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:530:13#012init@resource:///org/gnome/shell/ui/extensionSystem.js:48:9#012_initializeUI@resource:///org/gnome/shell/ui/main.js:242:5#012start@resource:///org/gnome/shell/ui/main.js:138:5#012@

:1:31

is this an effect of the fix?
We have this version of gnome-shell: gnome-shell-3.34.5-1.fc31.x86_64

@udovdh what you are seeing seem like warnings (I have a couple as well). We need to fix them too. But is the extension working for you with the latest git?

Extension was and is working!

git version still doesn't work for me, still getting the errors

Apr 15 00:18:12 throne gnome-shell[1455]: [System monitor] applet init from /home/scar/.local/share/gnome-shell/extensions/[email protected]
Apr 15 00:18:12 throne gnome-shell[1455]: JS ERROR: Extension [email protected]: Error: Tried to construct an object without a GType; are you using GObject.registerClass() when inheriting from a GObject type?#012SystemMonitor_TipItem@/home/scar/.local/share/gnome-shell/extensions/[email protected]/extension.js:669:13#012tip_format@/home/scar/.local/share/gnome-shell/extensions/[email protected]/extension.js:946:27#012SystemMonitor_Cpu@/home/scar/.local/share/gnome-shell/extensions/[email protected]/extension.js:1241:14#012createCpus@/home/scar/.local/share/gnome-shell/extensions/[email protected]/extension.js:1408:20#012enable@/home/scar/.local/share/gnome-shell/extensions/[email protected]/extension.js:2341:26#012_callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:148:32#012loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:280:26#012_loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:490:18#012collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:17#012_loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:469:19#012_enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:499:18#012_sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:530:18#012init@resource:///org/gnome/shell/ui/extensionSystem.js:48:14#012_initializeUI@resource:///org/gnome/shell/ui/main.js:242:22#012start@resource:///org/gnome/shell/ui/main.js:138:5#012@<main>:1:47

Only version that works for me is from fac6b7646346264bd75813a9d606dd5ba5152d6b above

I updated to ubuntu 20.04 git GNOME 3.36.1 recently and I had the same error. The discussion on the merge request #564 mentioned issues with version 38, a quick check in ~/.local/share/gnome-shell/extensions/[email protected]/metadata.json showed I had version 39 installed
After restarting the laptop the extension showed up. (I think restarting gnome shell would have been enough)

Found in my logs, running the git version:

May  6 05:08:54 bla journal[218300]: [System monitor] applet enabling
May  6 05:08:54 bla journal[218300]: JS WARNING: [/home/udo/.local/share/gnome-shell/extensions/[email protected]/extension.js 669]: Tried to construct an object without a GType; are you using GObject.registerClass() when inheriting from a GObject type?

(multiple...)

Ubuntu 20.04

Jun 05 11:41:49 katara gnome-shell[2705]: JS ERROR: Extension [email protected]: Error: Tried to construct an object without a GType; are you using GObject.registerClass() when inheriting from a GObject type?
                                          SystemMonitor_smDialog@/home/juanpi/.local/share/gnome-shell/extensions/[email protected]/extension.js:286:9
                                          enable@/home/juanpi/.local/share/gnome-shell/extensions/[email protected]/extension.js:2309:23

So far none of the workarounds seem to work

Debian GNOME Shell 3.34.4
Issue still exists :(

EDIT: After having a look in journalctl finding the stack trace:

Jun 08 09:22:08 araLap151 gnome-shell[2666]: JS ERROR: Extension [email protected]: Error: Tried to construct an object without a GType; are you using GObject.registerClass() when inheriting from a GObject type?
                                             SystemMonitor_TipItem@/home/chris/.local/share/gnome-shell/extensions/[email protected]/extension.js:669:13
                                             tip_format@/home/chris/.local/share/gnome-shell/extensions/[email protected]/extension.js:946:27
                                             SystemMonitor_Cpu@/home/chris/.local/share/gnome-shell/extensions/[email protected]/extension.js:1241:14
                                             createCpus@/home/chris/.local/share/gnome-shell/extensions/[email protected]/extension.js:1408:20
                                             enable@/home/chris/.local/share/gnome-shell/extensions/[email protected]/extension.js:2341:26

I had a look in the mentioned js file.

if (shell_Version < '3.36') {
    TipItem = class SystemMonitor_TipItem extends PopupMenu.PopupBaseMenuItem {
        constructor() {
            super();
            // PopupMenu.PopupBaseMenuItem.prototype._init.call(this);
            this.actor.remove_style_class_name('popup-menu-item');
            this.actor.add_style_class_name('sm-tooltip-item');
        }
    }
} else {

And it looks like the GObject.registerClass() is also introduced in one of the minor versions of 3.34.

So for a quick and dirty workaround changing if (shell_Version < '3.36') to if (shell_Version < '3.34') helps.

Obviously this is not the best solution but I hope it helps to fix this issue.

Perhaps the if should ask if GObject has the method registerClass instead?

Interestingly, the issue in Ubuntu 20.04 shows in my desktop computer but not in my laptop, where it runs smoothly. Maybe it is a dependency issue? My laptop has been updated since 18.04, while my desktop is freshly installed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

staticdev picture staticdev  路  5Comments

Byproduct picture Byproduct  路  4Comments

Ecron picture Ecron  路  12Comments

prhmnik picture prhmnik  路  14Comments

Alexander-Serov picture Alexander-Serov  路  9Comments