Skip to content

Commit

Permalink
Fix free meter widget when it's disabled
Browse files Browse the repository at this point in the history
MeterContainer object tried to remove added objects in the overridden destroy()
method when GJS raised this error:
"Object .Gjs_SystemLoadItemsContainer (0x5589c3107050), has been already finalized. Impossible to set any property to it."

This commit fixes that by removing the custom destroy() method, but
remove the widget from the panel and call the original destroy() method.
  • Loading branch information
elvetemedve committed Sep 16, 2018
1 parent 4c7aef0 commit 2ed1859
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
2 changes: 2 additions & 0 deletions [email protected]/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ var Menu = new Lang.Class({
if (this._meters[type]) {
this._meters[type].removeObserver(meter_widget);
}
this._widget_area_container.removeMeter(meter_widget);
meter_widget.destroy();
delete this._meter_widgets[type];
},
destroy: function() {
Expand Down
10 changes: 0 additions & 10 deletions [email protected]/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,6 @@ const MeterContainer = new Lang.Class({
},
update: function(state) {
this._label_item.setSummaryText(Math.round(state.percent) + ' %');
},
destroy: function() {
let actors = this.get_children();
for (let i = 0; i < actors.length; i++) {
let actor = actors[i];
this.remove_actor(actor);
actor.destroy();
actor = null;
}
this.parent();
}
});

Expand Down

0 comments on commit 2ed1859

Please sign in to comment.