Projects STRLCPY jadx Commits 84868917
🤬
  • fix(gui): resolve various minor issues

  • Loading...
  • Skylot committed 2 years ago
    84868917
    1 parent 4679172d
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■ ■
    jadx-gui/src/main/java/jadx/gui/jobs/BackgroundExecutor.java
    skipped 144 lines
    145 145   task.onDone(this);
    146 146   // treat UI task operations as part of the task to not mix with others
    147 147   UiUtils.uiRunAndWait(() -> {
    148  - progressPane.setVisible(false);
    149 148   task.onFinish(this);
     149 + progressPane.setVisible(false);
    150 150   });
    151 151   } finally {
    152 152   taskComplete(id);
     153 + progressPane.changeVisibility(this, false);
    153 154   }
    154 155   }
    155 156   return status;
    skipped 74 lines
    230 231   // force termination
    231 232   task.cancel();
    232 233   executor.shutdown();
    233  - if (executor.awaitTermination(5, TimeUnit.SECONDS)) {
     234 + if (executor.awaitTermination(2, TimeUnit.SECONDS)) {
    234 235   LOG.debug("Task cancel complete");
    235 236   return;
    236 237   }
    237 238   LOG.debug("Forcing tasks cancel");
    238 239   executor.shutdownNow();
    239  - boolean complete = executor.awaitTermination(30, TimeUnit.SECONDS);
     240 + boolean complete = executor.awaitTermination(5, TimeUnit.SECONDS);
    240 241   LOG.debug("Forced task cancel status: {}",
    241 242   complete ? "success" : "fail, still active: " + executor.getActiveCount());
    242 243   }
    skipped 63 lines
  • ■ ■ ■ ■ ■ ■
    jadx-gui/src/main/java/jadx/gui/ui/codearea/AbstractCodeArea.java
    skipped 355 lines
    356 356   return null;
    357 357   }
    358 358   
     359 + public boolean isDisposed() {
     360 + return node == null;
     361 + }
     362 + 
    359 363   public void dispose() {
    360 364   // code area reference can still be used somewhere in UI objects,
    361 365   // reset node reference to allow to GC jadx objects tree
    skipped 1 lines
    363 367   contentPanel = null;
    364 368   
    365 369   // also clear internals
     370 + setIgnoreRepaint(true);
     371 + setText("");
     372 + setEnabled(false);
     373 + setSyntaxEditingStyle(SYNTAX_STYLE_NONE);
    366 374   setLinkGenerator(null);
    367 375   for (MouseListener mouseListener : getMouseListeners()) {
    368 376   removeMouseListener(mouseListener);
    skipped 20 lines
  • ■ ■ ■ ■ ■
    jadx-gui/src/main/java/jadx/gui/ui/codearea/ClassCodeContentPanel.java
    skipped 164 lines
    165 165   } catch (Exception e) {
    166 166   LOG.debug("Failed to restore view position: {}", viewState.getViewPoint(), e);
    167 167   }
     168 + int caretPos = viewState.getCaretPos();
    168 169   try {
    169  - activePanel.getCodeArea().setCaretPosition(viewState.getCaretPos());
     170 + AbstractCodeArea codeArea = activePanel.getCodeArea();
     171 + int codeLen = codeArea.getDocument().getLength();
     172 + if (caretPos >= 0 && caretPos < codeLen) {
     173 + codeArea.setCaretPosition(caretPos);
     174 + }
    170 175   } catch (Exception e) {
    171  - LOG.debug("Failed to restore caret position: {}", viewState.getCaretPos(), e);
     176 + LOG.debug("Failed to restore caret position: {}", caretPos, e);
    172 177   }
    173 178   }
    174 179   
    skipped 13 lines
  • ■ ■ ■ ■ ■ ■
    jadx-gui/src/main/java/jadx/gui/ui/codearea/CodeArea.java
    skipped 84 lines
    85 85   @Override
    86 86   public ICodeInfo getCodeInfo() {
    87 87   if (cachedCodeInfo == null) {
     88 + if (isDisposed()) {
     89 + LOG.debug("CodeArea used after dispose!");
     90 + return ICodeInfo.EMPTY;
     91 + }
    88 92   cachedCodeInfo = Objects.requireNonNull(node.getCodeInfo());
    89 93   }
    90 94   return cachedCodeInfo;
    skipped 206 lines
  • ■ ■ ■ ■
    jadx-gui/src/main/java/jadx/gui/ui/codearea/JadxTokenMaker.java
    skipped 28 lines
    29 29   
    30 30   @Override
    31 31   public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
     32 + if (codeArea.isDisposed()) {
     33 + return new TokenImpl();
     34 + }
    32 35   try {
    33 36   Token tokens = super.getTokenList(text, initialTokenType, startOffset);
    34  - if (tokens.getType() != TokenTypes.NULL) {
     37 + if (tokens != null && tokens.getType() != TokenTypes.NULL) {
    35 38   processTokens(tokens);
    36 39   }
    37 40   return tokens;
    skipped 101 lines
Please wait...
Page is in error, reload to recover