Merge lp:~davidmhewitt/wingpanel/fix-empty-indicator into lp:~wingpanel-devs/wingpanel/trunk

Proposed by David Hewitt
Status: Merged
Approved by: David Hewitt
Approved revision: 175
Merged at revision: 175
Proposed branch: lp:~davidmhewitt/wingpanel/fix-empty-indicator
Merge into: lp:~wingpanel-devs/wingpanel/trunk
Diff against target: 23 lines (+5/-3)
1 file modified
src/Widgets/IndicatorMenuBar.vala (+5/-3)
To merge this branch: bzr merge lp:~davidmhewitt/wingpanel/fix-empty-indicator
Reviewer Review Type Date Requested Status
Kirill Romanov (community) test Approve
WingPanel Devs Pending
Review via email: mp+319754@code.launchpad.net

Commit message

Prevent adding an indicator with the same code_name twice

Description of the change

Was experiencing the linked bug with the Slack indicator. There would be an empty space to the right of it which opened an empty popover when you clicked it.

It seems like two Indicator objects are created for some of the Ayatana indicators. To prevent them both being added, we now compare the code name instead of just the object reference to prevent the same indicator being added twice.

To post a comment you must log in.
Revision history for this message
Djax (parnold-x) wrote :

Hey, they were after the iterate before and we moved it up because this was a issue in some case. Don't remember why.

I think the core issue with this problem is that the ayatana indicator is loaded. It loads again all the ayatana indicators and register them. So while it iterates over the get_indicators () the ayatana register new indicators to the list and so it iterates over the new ones in the forach and the indicator_added signal is triggered.

So I think the get_indicators of the manager should maybe return something not modifiable.

Revision history for this message
David Hewitt (davidmhewitt) wrote :

Here is the merge where the signals were moved above the iterate for reference:
https://code.launchpad.net/~parnold-x/wingpanel/fix_ayatana_reload/+merge/300977

I'll take another look at this later and see if I can propose a better solution. Thanks.

Revision history for this message
David Hewitt (davidmhewitt) wrote :

Ok, so I've reverted the change to the ordering of when the signals were connected as I was able to confirm that it introduced a regression.

I've now changed the check that's used before adding the indicator to ensure we don't add the same one twice. Let me know if it works for you.

175. By David Hewitt

Merged trunk

Revision history for this message
Kirill Romanov (djaler1) wrote :

It works good!

review: Approve (test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Widgets/IndicatorMenuBar.vala'
2--- src/Widgets/IndicatorMenuBar.vala 2015-10-20 14:06:58 +0000
3+++ src/Widgets/IndicatorMenuBar.vala 2017-03-18 10:30:41 +0000
4@@ -26,8 +26,10 @@
5 }
6
7 public void insert_sorted (IndicatorEntry item) {
8- if (item in sorted_items) {
9- return; /* item already added */
10+ foreach (var indicator in sorted_items) {
11+ if (item.base_indicator.code_name == indicator.base_indicator.code_name) {
12+ return; /* item already added */
13+ }
14 }
15
16 item.menu_bar = this;
17@@ -68,4 +70,4 @@
18 }
19 }
20 }
21-}
22\ No newline at end of file
23+}

Subscribers

People subscribed via source and target branches

to all changes: