Opened 12 years ago
Closed 12 years ago
#7541 closed defect (fixed)
Preferences changeListener broken, triggered multiple times when switching to a net-yet-created pref tab
Reported by: | xeen | Owned by: | Don-vip |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core | Version: | latest |
Keywords: | preferences perf | Cc: | xeen |
Description
I added debug output to the plugin prefs because the plugin list was loaded twice when switching to the tab and then again when navigation away from it. It only adds one change listener, so the problem is "further up".
Adding listener Selected paneNo : 3 Selected paneNo : 4 Selected paneNo : 3 Selected paneNo : 3 Selected paneNo : 2 Selected paneNo : 3 Selected paneNo : 2 Selected paneNo : 2 Selected paneNo : 1 Selected paneNo : 2 Selected paneNo : 1 Selected paneNo : 1
I added the newlines for readability, each block is executed when switching the tab. The order is 3, 2, 1 with 3 being the plugins tab and none of the tabs having been loaded so far. After that, it works as expected:
Selected paneNo : 3 Selected paneNo : 2 Selected paneNo : 1
Attachments (1)
Change History (7)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
How did you add your debug code ? I have fixed the problem with plugins list but I'm not sure there is not a remaining problem in change events.
comment:3 by , 12 years ago
I added it in stateChanged method in PluginPreferenceActivationListener. Your patch fixes the problem, but the superfluous change events remain.
I did a quick check and it appears the plugin pref is the only plugin listening for tab switch to find out it’s been activated. Given that now each tab is only generated after it has been selected, wouldn’t it be better to simply remove the listener and comment-in the line you commented out in r5117? This doesn’t fix the superfluous events, but since we don’t actually care anymore about them…
comment:4 by , 12 years ago
I haven’t checked the history of the pref plugins… but do we actually need to re-read the local plugin data on tab switch? Before r5117 they would be read on every "show", now only once. I don’t know about before that, though.
by , 12 years ago
Attachment: | 7541.patch added |
---|
This works for me. Plugin list is only loaded once and properly displayed. The progress bar probably needs to be reworked though since it hides even when the list is still being rendered. This patch only applies if it’s enough to read the plugin data once.
comment:5 by , 12 years ago
Much nicer :) Note the second call to refreshView() is not even needed. I commit it with another patch to keep scrollbar position when we really refresh the list by clicking the Download button.
In 5117/josm: