martinpl / tray-icons-reloaded

GNOME Shell extension which bring back Tray Icons to top panel, with additional features.
GNU General Public License v3.0
492 stars 29 forks source link

Wrong icon position. #19

Closed dziq closed 3 years ago

dziq commented 3 years ago

Hi there. Thanks for great extension. I've used it a lot on Gnome 3.36 and it works quite well. After upgrade to G 3.38 I have some issues. If other icons on tray are updating eg. OpenWeaher changing icon shape, yours extension doesn't move icons according to this change. The same is happening after login from lock screen. The icons looks like they are behind other. I can't click on it or do anything. Alt + r (on Xorg) solve this issue for a while.

Fedora Silverblue 33 with Gnome 3.38 on Xorg session. Thanks in advance. tray

As you can see in the screenshot. Nextcloud tray icon is behind other icons. The black space between telegram and openweather is clickable place for nextcloud.

martinpl commented 3 years ago

Thanks for report, few things:

dziq commented 3 years ago

Same behaviour with old version. I have disabled few other extensions but this bug still exists quite randomly. I don't know if there is simplest way to reproduce this issue.

Noobsai commented 3 years ago

Hi, can confirm and reproduce this issue. Bug is appearing after waking up from a Blank Screen (in power setting a time when display turned off). First screen after waking up Screenshot from 2020-11-01 22-28-34 On the second screen I changed NetSpeed view (by the middle click) Screenshot from 2020-11-01 22-28-50 The Transmision icon remains in the same position on the screen without any action when pressed, but container of the icon moves correctly and remains active by clicking. Looks like the first icon had lost its container. After restarting the shell, the issue is disappearing

martinpl commented 3 years ago

Maybe there are some interesting logs, try reproduce with journalctl /usr/bin/gnome-shell -f

Noobsai commented 3 years ago

You are right, there is something interesting:

Nov 01 23:22:57 reisub-pc gnome-shell[8664]: [System monitor] applet disable
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: Object St.Button (0x55ba376c4710), has been already deallocated — impossible to access it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: == Stack trace for context 0x55ba335dc200 ==
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #0   55ba34254ab0 i   /home/reisub/.local/share/gnome-shell/extensions/trayIconsReloaded@selfmade.pl/TrayIndicator.js:71 (103b84bd3d30 @ 17)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #1   55ba34254a20 i   /home/reisub/.local/share/gnome-shell/extensions/trayIconsReloaded@selfmade.pl/extension.js:27 (103b84bd3880 @ 33)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #2   55ba34254970 i   resource:///org/gnome/gjs/modules/script/_legacy.js:82 (3c7c1e3981a0 @ 69)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #3   55ba342548c8 i   /home/reisub/.local/share/gnome-shell/extensions/trayIconsReloaded@selfmade.pl/extension.js:91 (103b84bd35b0 @ 18)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #4   7ffd46047a90 b   resource:///org/gnome/shell/ui/extensionSystem.js:108 (14dc56936a60 @ 395)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #5   55ba34254838 i   resource:///org/gnome/shell/ui/extensionSystem.js:611 (14dc5692ce70 @ 15)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #6   7ffd46048540 b   self-hosted:225 (3c7c1e398a60 @ 273)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #7   55ba342547a8 i   resource:///org/gnome/shell/ui/extensionSystem.js:610 (14dc5692cec0 @ 98)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #8   55ba34254718 i   resource:///org/gnome/shell/ui/extensionSystem.js:628 (14dc5692ce20 @ 82)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #9   7ffd46048fc0 b   self-hosted:844 (7c814ff8d30 @ 423)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #10   7ffd460490b0 b   resource:///org/gnome/gjs/modules/core/_signals.js:133 (3c7c1e3985b0 @ 439)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #11   7ffd46049cf0 b   resource:///org/gnome/shell/ui/sessionMode.js:195 (7c814f9f650 @ 284)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #12   55ba342544b8 i   resource:///org/gnome/shell/ui/sessionMode.js:156 (7c814f9f790 @ 40)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #13   55ba34254400 i   resource:///org/gnome/shell/ui/screenShield.js:572 (7c814f8c560 @ 208)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #14   55ba34254368 i   resource:///org/gnome/shell/ui/screenShield.js:308 (7c814f8cc90 @ 36)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #15   7ffd4604a920 b   self-hosted:844 (7c814ff8d30 @ 454)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #16   55ba342542d8 i   resource:///org/gnome/shell/ui/lightbox.js:193 (14dc569190b0 @ 29)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #17   55ba34254248 i   resource:///org/gnome/shell/ui/environment.js:84 (3c7c1e383bf0 @ 98)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: #18   55ba342541b8 i   resource:///org/gnome/shell/ui/environment.js:165 (3c7c1e3838d0 @ 14)
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: clutter_actor_destroy: assertion 'CLUTTER_IS_ACTOR (self)' failed
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: ../glib/gobject/gsignal.c:2731: instance '0x55ba36487a60' has no handler with id '10670'
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: ../glib/gobject/gsignal.c:2731: instance '0x55ba36487a60' has no handler with id '10671'
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: Window manager warning: MetaSyncRing: Sync object is not ready -- were events handled properly?
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: Window manager warning: MetaSyncRing: Sync object is not ready -- were events handled properly?
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: Window manager warning: MetaSyncRing: Sync object is not ready -- were events handled properly?
Nov 01 23:22:57 reisub-pc gnome-shell[8664]: Window manager warning: MetaSyncRing: Too many reboots -- disabling

Get the same twice

Noobsai commented 3 years ago

Hi! Last night I tried to debug code and added some lines to write into log. Also added button.connect('destroy' () => { log(...); }); This is a first initialization after shell restart:

icon added(1): discord button:[0x5609ed66d460 StButton] _overflow=undefined
_refreshIcons
_refreshIcons inOverflow != overflowdiscord
removeIcon discord get_parent [0x5609ed66d460 StButton]
button destroy discord button:[0x5609ed66d460 StButton]
icon added(1): discord button:[0x5609eda48eb0 StButton] _overflow=false
_refreshIcons
icon added(2): vlc button:[0x5609eda4c2a0 StButton] _overflow=false
_refreshIcons
icon added(3): Transmission button:[0x5609eda4eca0 StButton] _overflow=false
_refreshIcons
icon added(4): TelegramDesktop button:[0x5609eda530a0 StButton] _overflow=false
_refreshIcons

And bug was triggered:

button destroy TelegramDesktop button:[0x5609eda530a0 StButton:first-child]
icon destroy start: TelegramDesktop button:[0x5609eda530a0 StButton:first-child] parent:[0x5609eda530a0 StButton:first-child]
icon destroy done: TelegramDesktop button:[0x5609eda530a0 StButton:first-child] parent:[0x5609eda530a0 StButton:first-child]

button destroy Transmission button:[0x5609eda4eca0 StButton]
icon destroy start: Transmission button:[0x5609eda4eca0 StButton] parent:[0x5609eda4eca0 StButton]
icon destroy done: Transmission button:[0x5609eda4eca0 StButton] parent:[0x5609eda4eca0 StButton]

button destroy vlc button:[0x5609eda4c2a0 StButton]
icon destroy start: vlc button:[0x5609eda4c2a0 StButton] parent:[0x5609eda4c2a0 StButton]
icon destroy done: vlc button:[0x5609eda4c2a0 StButton] parent:[0x5609eda4c2a0 StButton]

button destroy discord button:[0x5609eda48eb0 StButton:last-child]
Object St.Button (0x5609ed66d460), has been already deallocated — impossible to access it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
icon destroy start: discord button:[null] parent:[0x5609eda48eb0 StButton:last-child]
Object St.Button (0x5609ed66d460), has been already deallocated — impossible to access it. This might be caused by the object having been destroyed from C code using something such as destroy(), dispose(), or remove() vfuncs.
icon destroy done: discord button:[null] parent:[0x5609eda48eb0 StButton:last-child]
icon destroy start: discord button:[0x5609eda48eb0 StButton:last-child] parent:[0x5609eda48eb0 StButton:last-child]
icon destroy done: discord button:[0x5609eda48eb0 StButton:last-child] parent:[0x5609eda48eb0 StButton:last-child]

Take a look at 0x5609ed66d460 StButton, then it added, removed and destroyed.

The first problem here

        if(this._overflow) {
            this._menuItem.actor.add(button);
        } else {
            this._indicators.insert_child_at_index(button, 0);
        }

For the first icon _overflow == undefined, so this run an else statement. The second problem in the removeIcon function.

        const actor = icon.get_parent();
        actor.remove_actor(icon);
        actor.destroy();

This is disposing the button, but I think the button should be also removed from _menuItem or _indicators. Because according the logs a destroy event on TrayIndicator trying to destroy button in _menuItem or _indicators. If don't add button to _menuItem or _indicators the disposing issue is gone. If don't add button when _overflow is undefined, described issue in this topic is gone, but disposing error still occur. Because something keep information about created buttons and dispose buttons in the global TrayIndicator destroy event. So this code resolve the issue, but disposing problem still exist

        if(this._overflow === true) {
            this._menuItem.actor.add(button);
        } 

        if(this._overflow === false) {
            this._indicators.insert_child_at_index(button, 0);
        }

Or rewrite the code so as not to call removeIcon after adding first icon on initialization.

Thanks!

martinpl commented 3 years ago

Can you try dev branch? https://github.com/MartinPL/Tray-Icons-Reloaded/archive/dev.zip

Noobsai commented 3 years ago

Yes, this version works. Thank you!

martinpl commented 3 years ago

Thanks for help with debugging, tomorrow I will send release.

dziq commented 3 years ago

I can confirm, Dev release is working fine. Thanks for quick response.