GUI: Refactor: Show modal JavaWindows without blocking Matlab thread - #939
Draft
rcassani wants to merge 2 commits into
Draft
GUI: Refactor: Show modal JavaWindows without blocking Matlab thread#939rcassani wants to merge 2 commits into
rcassani wants to merge 2 commits into
Conversation
- Shown modal `JavaWindows` after adding them to the Global panel list - Update values and title for `panel_subject_editor` before `gui_show` - Update preferred size of `panel_protocol_editor` before `gui_show`
rcassani
referenced
this pull request
Aug 19, 2026
- Shown modal `JavaWindows` after adding them to the Global panel list - Update values and title for `panel_subject_editor` before `gui_show` - Update preferred size of `panel_protocol_editor` before `gui_show`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes the call to
awtinvoketojava_call(which preferentially usesjavaMethodEDT).The change has as goal to remove the reliance in
awtinvokeas per the following warning (introduced in R2026a, and reported by @jeanborn and @Edouard2laire).In the current (before this PR code), calling
awtinvokedoes not block the Matlab thread even when theJavaWindowis modal, so all the Matlab code continue. In the case of modal windows there are two approaches:The panel gives the impression that the Matlab thread is blocked, as the Matlab code after creating the modal window just do minor changes in the panel (no further commands) e.g.
panel_protocol_editor. So, only the callbacks of the panel remained to be executed.Where a real block of the Matlab thread is needed, the function
bst_mutex()is used in the creation of the panel. And the[OK]button callback releases this mutex.Now, by changing
awtinvoketojava_callthere is a block of the Matlab thread when the modalJavaWindowis shown. So there is the need of refactor in both cases of modal windows:In this case, just perform all the panel modifications and set its callbacks before showing the modal
JavaWindow(Commit 9edd66a). Only the callbacks of the panel need to be executed.Panels with
bst_mutex, e.g.panel_timefreq_options. Here, the Matlab thread is blocked by the modal window, thus its[OK]button callback does not work (it just releases the mutex). Ideally, when this panels are called, in modal mode, there is no need of the mutex, as the block will come fromjava_call.