fix(gui): use UI thread for refreshStackFrameList in debugger view (PR #2807)

* fix(gui): use UI thread for refreshStackFrameList in debugger view

* call `resetAllDebuggingInfo` also from UI thread

---------

Co-authored-by: Skylot <118523+skylot@users.noreply.github.com>
This commit is contained in:
Jan S.
2026-02-27 17:49:04 +01:00
committed by GitHub
parent 468b52342d
commit ff4dde62ae
2 changed files with 13 additions and 10 deletions
@@ -905,8 +905,8 @@ public final class DebugController implements SmaliDebugger.SuspendListener, IDe
private void resetAllInfo() {
isSuspended = true;
toBeUpdatedTreeNode = null;
debuggerPanel.resetAllDebuggingInfo();
cur.reset();
UiUtils.uiRun(debuggerPanel::resetAllDebuggingInfo);
}
private List<RuntimeVarInfo> getRuntimeDebugInfo(FrameNode frame) {
@@ -1367,7 +1367,7 @@ public final class DebugController implements SmaliDebugger.SuspendListener, IDe
}
}
private static class FieldTreeNode extends RuntimeValueTreeNode {
static class FieldTreeNode extends RuntimeValueTreeNode {
private static final long serialVersionUID = -1111111202103122235L;
private final RuntimeField field;
@@ -448,6 +448,7 @@ public class JDebuggerPanel extends JPanel {
}
public void resetAllDebuggingInfo() {
UiUtils.uiThreadGuard();
clearFrameAndThreadList();
resetRegTreeNodes();
resetThisTreeNodes();
@@ -483,13 +484,15 @@ public class JDebuggerPanel extends JPanel {
}
public void refreshStackFrameList(List<? extends IListElement> elements) {
if (elements.size() > 0) {
DefaultListModel<IListElement> model =
(DefaultListModel<IListElement>) stackFrameList.getModel();
elements.forEach(model::addElement);
stackFrameList.setFont(mainWindow.getSettings().getCodeFont());
}
SwingUtilities.invokeLater(stackFrameList::repaint);
UiUtils.uiRun(() -> {
if (!elements.isEmpty()) {
DefaultListModel<IListElement> model =
(DefaultListModel<IListElement>) stackFrameList.getModel();
model.addAll(elements);
stackFrameList.setFont(mainWindow.getSettings().getCodeFont());
}
stackFrameList.repaint();
});
}
public void refreshRegisterTree() {
@@ -578,7 +581,7 @@ public class JDebuggerPanel extends JPanel {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder(64);
sb.append(getName());
String val = getValue();
if (val != null) {