Bug 129318 - [Preferences] ScopedPreferenceStore forever disconnected after last call to removePropertyChangeListener
Summary: [Preferences] ScopedPreferenceStore forever disconnected after last call to ...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 130807 131454 (view as bug list)
Depends on:
Blocks: 129216
  Show dependency tree
 
Reported: 2006-02-24 06:49 EST by Dani Megert CLA
Modified: 2006-03-29 10:43 EST (History)
2 users (show)

See Also:


Attachments
Patch to fix the bug (909 bytes, patch)
2006-02-24 06:49 EST, Dani Megert CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2006-02-24 06:49:19 EST
R3.1 and newer

If ScopedPreferenceStore .removePropertyChangeListener(...) removes the last listener it calls disposePreferenceStoreListener() which disconnects the ScopedPreferenceStore from the eclipse store but does not set preferencesListener to null. Now, when the next client calls addPropertyChangeListener(...) this methods calls initializePreferencesListener() which does nothing because preferencesListener is not null. Therefore the store remains disconnected from the Eclipse preferences and hence property/pref changes are not forwarded to the added listeners.

Test Case:
1. open Text editor
2. change the 'Current line highlight' color via Text Editors pref page
   ==> changed in editor
3. close the editor (this disconnects the scope store forever)
4. open Text editor
5. change the 'Current line highlight' color via Text Editors pref page
   ==> change does not happen in the editor

NOTE: we did not detect this earlier because for non-string preferences this works since ScopedPreferenceStore.setValue(String, <type>) calls firePropertyChangeEvent() for all types (e.g. boolean) except for String typed preferences. Why?
Comment 1 Dani Megert CLA 2006-02-24 06:49:57 EST
Created attachment 35295 [details]
Patch to fix the bug
Comment 2 Tod Creasey CLA 2006-02-28 10:57:39 EST
Thanks for the patch Dani - looks good.

To answer your question we don't fire the property changed event for Strings as we can forward the event from the core preferences to our event without modification as the core event is always sent as a String.

For the other types we have to ignore the core event as the typing is wrong so we send it ourselves.
Comment 3 Tod Creasey CLA 2006-02-28 14:12:16 EST
Fixed in build >20060228
Comment 4 Dani Megert CLA 2006-03-13 04:37:44 EST
*** Bug 130807 has been marked as a duplicate of this bug. ***
Comment 5 Dani Megert CLA 2006-03-13 10:19:15 EST
*** Bug 131454 has been marked as a duplicate of this bug. ***
Comment 6 Tod Creasey CLA 2006-03-29 10:43:00 EST
Verified in 20060328