elvetemedve / gnome-shell-extension-system-monitor

Gnome Shell extension for displaying resource usage
GNU General Public License v3.0
87 stars 14 forks source link

[BUG]: Endless adding icons #79

Open str-username opened 2 years ago

str-username commented 2 years ago

Which leads to the error:

Result

You should see that icons are created but not deleted

Info

OS: Linux version 5.8.0-63-generic (buildd@lgw01-amd64-035) (gcc (Ubuntu 9.3.0-17ubuntu1-20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #71-20.04.1-Ubuntu SMP Thu Jul 15 17:46:08 UTC 2021 Gnome: gnome-shell --version GNOME Shell 3.36.9

Log


Jul 30 21:01:31 laptop gnome-shell[1875]: JS ERROR: TypeError: this._meters[type] is undefined#012_destroyIcon@/home/nikolay/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/view.js:115:9#012_addSettingChangedHandler/event_id<@/home/user/.local/share/gnome-shell/extensions/System_Monitor@bghome.gmail.com/view.js:129:22
elvetemedve commented 2 years ago

Nice finding!

str-username commented 2 years ago

I tried to fix this for myself (dirty fix) and it worked for me: before https://github.com/elvetemedve/gnome-shell-extension-system-monitor/blob/d8d261959a5cd992a65999fd48dca9c86041b579/System_Monitor%40bghome.gmail.com/view.js#L168-L176

after

_handleActivityChange(settings, key) {
  let meters = this._meters;
  let event_id = this._settings.connect('changed::' + type, function(settings, key) {
      let is_enabled = settings.get_boolean(key);
      if (is_enabled) {
          let icon = that._createIcon(type);
          that._createMeterWidget(type, icon);
      } else {
          that._destroyIcon(type);
          that._destroyMeterWidget(type);
      }
  });
  this._initIconsAndWidgets();
}