-
Notifications
You must be signed in to change notification settings - Fork 185
Do not call addListener in constructors of CCombo and StyledText #2733 #2739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Do not call addListener in constructors of CCombo and StyledText #2733 #2739
Conversation
Test Results 118 files ±0 118 suites ±0 16m 6s ⏱️ - 1m 33s Results for commit ad8479c. ± Comparison against base commit 136b375. This pull request skips 1 test.♻️ This comment has been updated with latest results. |
fe59a75 to
fd59b1a
Compare
|
Need to rethink this since the replacement is also official API and can therefore also be overridden |
19a9c1a to
887d96c
Compare
|
I've added 2 internal-API FTR the calls that I am correcting in this PR have been introduced recently: |
HeikoKlare
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe an unconventional thought on avoiding such a new API for just a very specific use case: what about wrapping the addListener calls into a display.asyncExec()? I think it's not necessary that the listeners are registered synchronously, so that could move it out of the constructor to avoid the potential problems with overwritten methods as well.
|
In principle it could work but I fear that it would mean that one needs to check for disposal when overriding the public |
Why should that be necessary? You would check for disposal before calling |
|
hm. on a second thought: consumers should be checking for disposal already. I mean the original eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Widget.java Lines 231 to 235 in 136b375
You're right, that would be easily solvable on my side by calling I'll adapt my PR with your suggestion 👍 |
887d96c to
aa30ff0
Compare
|
Adapted |
HeikoKlare
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for the widget check, the change looks sound to me. @akoch-yatta what do you think? Do we miss anything?
bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
Outdated
Show resolved
Hide resolved
…lipse-platform#2733 The method is not final, which may cause issues if a subclass overrides it because it ends up being called upon instantiation, when the object is not fully initialized. Fixes eclipse-platform#2733
aa30ff0 to
ad8479c
Compare
The method is not final, which may cause issues if a subclass overrides it because it ends up being called upon instantiation, when the object is not fully initialized
Since these 2 classes are not in the same package as other subclasses of Widget, I had to resort to expanding the functionality in TypedListener.
Fixes #2733