Skip to content
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

Threading breaks .U and Canvas in AyaIDE #108

Open
BlazingTwist opened this issue Oct 31, 2024 · 1 comment
Open

Threading breaks .U and Canvas in AyaIDE #108

BlazingTwist opened this issue Oct 31, 2024 · 1 comment
Labels

Comments

@BlazingTwist
Copy link
Contributor

BlazingTwist commented Oct 31, 2024

#92 introduced an issue where the IDE seems to deadlock itself when opening Swing UI while running code from the editor.

Steps to reproduce

  • put "test" .U in the Editor Window
  • Run the Editor

Results in:
image


Probable cause:

https://github.com/aya-lang/aya/blob/3ab481f2eb3d14aac7d9a154db3c44a9bff12cf6/src/ui/EditorWindow.java#L224C4-L224C50

This is executed by the Swing Thread.
Hence the Swing thread is waiting for the instruction to return.
Which in turn is waiting for the Swing Thread to close the popup.


Possible fix

Wrapping it in a new Thread seems to work.
I have not thought about possible side-effects this causes though

			new Thread(() -> {
				try {
					ExecutionResult res = _aya.waitForResponse();
					InteractiveAya.printResult(StaticData.IO, res);
				} catch (ThreadError e) {
					StaticData.IO.err().print(e.getMessage());
				} catch (InterruptedException e) {
					e.printStackTrace(StaticData.IO.err());
				}
			}).start();
@nick-paul
Copy link
Collaborator

I'm able to reproduce the issue with the dialog instructions as well.

Run in editor:

import ::dialog
"test" dialog.alert

Thanks for the report, I'll dig into this a bit more to see what the best solution would be.

@nick-paul nick-paul added the bug label Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants