axxapy / gnome-ui-tune

Tunes overview UI of the gnome 40 a bit
GNU General Public License v3.0
102 stars 10 forks source link

Object .Gjs_ui_workspaceThumbnail_ThumbnailsBox has been already disposed — impossible to get any property from it. #37

Closed defunctl closed 7 months ago

defunctl commented 11 months ago

Gnome: 45.1 gnome-ui-tune: 1.8.0

Logs contain a lot of this:

Object .Gjs_ui_workspaceThumbnail_ThumbnailsBox (0x562b87f15c10), has been already disposed — impossible to get any property from it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
                                                   == Stack trace for context 0x562b749ab400 ==
                                                   #0   7ffcf9acf840 b   file:///usr/share/gnome-shell/extensions/gnome-ui-tune@itstime.tech/src/modScaleThumbnails.js:26 (1969987b4240 @ 33)
                                                   #1   7ffcf9acf980 b   resource:///org/gnome/shell/ui/workspacesView.js:693 (b33a4b083d0 @ 433)
                                                   #2   562b74a75738 i   resource:///org/gnome/shell/ui/workspace.js:856 (1516dc0c1740 @ 378)
                                                   #3   562b74a756b0 i   resource:///org/gnome/shell/ui/workspace.js:808 (1516dc0c16a0 @ 17)
                                                   #4   562b74a75618 i   resource:///org/gnome/shell/ui/workspacesView.js:1014 (b33a4b08d80 @ 129)
                                                   #5   562b74a75588 i   resource:///org/gnome/shell/ui/overviewControls.js:699 (1516dc07aa60 @ 50)
                                                   #6   562b74a75500 i   resource:///org/gnome/shell/ui/layout.js:373 (1969987cefb0 @ 22)
                                                   #7   562b74a75470 i   resource:///org/gnome/shell/ui/overview.js:650 (1516dc0778d0 @ 164)
                                                   #8   562b74a753f0 i   resource:///org/gnome/shell/ui/overview.js:636 (1516dc077880 @ 12)
                                                   #9   562b74a75370 i   resource:///org/gnome/shell/ui/overviewControls.js:750 (1516dc07ac90 @ 55)
                                                   #10   7ffcf9ad6dd0 b   resource:///org/gnome/shell/ui/environment.js:84 (b33a4b56ba0 @ 39)
                                                   #11   562b74a752e8 i   resource:///org/gnome/shell/ui/environment.js:250 (2408b078f8d0 @ 14)
                                                   #12   562b74a75258 i   resource:///org/gnome/shell/ui/init.js:21 (196998770ba0 @ 48)
axxapy commented 10 months ago

try to apply the following diff and see if error is still in the logs:

diff --git a/src/modScaleThumbnails.js b/src/modScaleThumbnails.js
index dfe110b..54875f0 100644
--- a/src/modScaleThumbnails.js
+++ b/src/modScaleThumbnails.js
@@ -23,7 +23,7 @@ export default class extends Mod {
         const __scaleFactor = this.scaleFactor
         this.bkp_SecondaryMonitorDisplay_getThumbnailsHeight = SecondaryMonitorDisplay.prototype._getThumbnailsHeight
         SecondaryMonitorDisplay.prototype._getThumbnailsHeight = function(box) {
-            if (!this._thumbnails.visible)
+            if (!this || !this._thumbnails || !this._thumbnails.visible)
                 return 0;

             this._thumbnails._maxThumbnailScale = __scaleFactor

file location: ~/.local/share/gnome-shell/extensions/gnome-ui-tune@itstime.tech/src/modScaleThumbnails.js