Skip to content

Removed code apparently copied and pasted from RocketComponentConfig.… - #2809

Closed
jimmiedave wants to merge 2 commits into
openrocket:unstablefrom
jimmiedave:unstable
Closed

jimmiedave wants to merge 2 commits into
openrocket:unstablefrom
jimmiedave:unstable

Conversation

@jimmiedave

Copy link
Copy Markdown
Contributor

Removed code from SaveDesignInfoPanel.java which was apparently pasted from RocketComponentConfig.java. The removed code was causing misbehavior from an unrelated preference setting (former lines 61-73 of SaveDesignInfoPanel) and causing spurious document.undo() actions upon dialog cancel (former line 81): there should be nothing to undo re: the SaveDesignInfoPanel. This should resolve #2680

…java. The removed code responded to preferences setting for Components - there is no preferences setting for the SaveDesignInfoPanel - in the same way that RocketComponentConfig.java did. This should resolve openrocket#2680
@senft-research

Copy link
Copy Markdown
Contributor

When you say "should", was it checked if the issue in #2680 was resolved by the removal of this?

@jimmiedave

jimmiedave commented May 21, 2025 •

Copy link
Copy Markdown
Contributor Author

Heh. Good point: I hate seeing "should" in requirements docs and the like.

  1. Yes, it does fix the steps-to-repro demonstration of the problem: cancelling the SaveDesignInfoPanel no longer reverts the last prior change to config or sim. Because of the way the bug operated, I'd initially suspected a rogue "undo", and yep, found one, removed it.

  2. "Should" because upon removing code that refers to prefs for the RocketComponentConfig dialog (that is pretty clearly a copy-paste that didn't get tidied up: you're starting a new dialog, copy/paste from a working one...), I'm just about certain that code has no place in SaveDesignInfoPanel, but am less certain that it can't ever be called from elsewhere (some languages have GOTO, but what language has COMEFROM?). I did use the IDE to look for any usages and didn't find anything problematic. On this piece, I'd place my certainty higher than 99%.

PS - before removing the copy/paste code, I did go over what the code was doing, and made sure I understood why it would've been there (in the original dialog) and why it didn't belong here.

@senft-research

Copy link
Copy Markdown
Contributor

Aye sound, and cheers for going into detail and humouring my pedantic nature 😅

…argeted to new method cancelClose() (from prior target copyChangesToAllSims, which was left alone). Cancel button's actionPerformed method retargeted to cancelClose(). cancelClose() created with prior contents of Cancel button's actionPerformed method. windowListener removal line changed to target windowCloseCancelListner().
@jimmiedave

Copy link
Copy Markdown
Contributor Author

Gotta pull this back to fix.

@jimmiedave jimmiedave closed this May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] TITLE CHANGE: Cancelling "Save design info" dialog during "Save as..." REVERTS MOST RECENT CHANGE to component/simulation

2 participants