fix: lazy initialize ImageRegistry#1011
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates TMUIPlugin.start() to avoid SWTError: Invalid thread access by deferring image-registry initialization to the UI thread when the Eclipse workbench is running (addressing issue #1010 seen in headless/LSP test scenarios).
Changes:
- Replace direct image initialization in
TMUIPlugin.start()with a dedicatedinitializeImages()helper. - Schedule
TMImagesinitialization via an EclipseUIJobwhenPlatformUI.isWorkbenchRunning()is true.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@akurtakov do you think a more idomatic solution would be to not initialize the image registry in the start method or async via UIJob but lazy like this? @Override
protected void initializeImageRegistry(final ImageRegistry registry) {
TMImages.initalize(registry);
} |
|
@akurtakov ping :-) |
|
@sebthom Sorry, this one got lost in the amount of notifications. |
This change adjusts TMUIPlugin.start() to not initialize the ImageRegistry, avoiding start-up exceptions when TMUIPlugin.start() is not called from a UI thread. Instead, the ImageRegistry is initialized lazily by overriding: AbstractUIPlugin.initializeImageRegistry() Fixes: eclipse-tm4e#1010
|
Thanks! |
|
Thank you for merging! |
This change adjusts
TMUIPlugin.start()to not initialize theImageRegistry, avoiding start-up exceptions whenTMUIPlugin.start()is not called from a UI thread.Instead, the
ImageRegistryis initialized lazily by overriding:AbstractUIPlugin.initializeImageRegistry()Fixes: #1010