-
Notifications
You must be signed in to change notification settings - Fork 189
[mac]SWT_AWT: synchronize the main thread and the awt thread #2901
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?
Conversation
|
Not yet working flawlessly, there is still an NPE: Exception in thread "main" org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.swt.SWTException: Widget is disposed) |
|
Snippet for reproduction. Execute the Snippet and click in the left awt TextArea. The focus does not work. At 1000 FOCUS_CHANGES, also my fix can't prevent the focus bug. By the way my system: |
On Mac.
My system:
Apple M3
16 GB
macOS Tahoe 26.1
With SWT: 3.133.0
In SWT is a bug, which harms the focus handling of embedded awt features.
The scenario is the following:
If we have two SWT_AWT-frames running with our AWT code, then if we switch the perspective, the focus handling of the AWT feature fails. Sometimes one of the two AWT applications no longer can get focus at all.
The reason for this behavior seems to be that the AWT activation will be executed a queue (see class SWT_AWT) and not in the SWT main thread, which means that there is a delay at the execution.
If the parent composite of SWT_AWT already lost the focus, then the AWT frame still can get focus, while the second AWT frame could request the focus at almost the same time. It seems this can break the focus handling of the AWT frame.
Since at a perspective change the focus changes happen very fast in a very short time, this can cause this bug.
As a solution we can synchronize the SWT main thread with the AWT thread.
This means:
I will check whether I can provide a standalone snippet, which reproduces this bug.