Skip to content

Commit

Permalink
fix #23447:Fatal "crash" attempting to delete all "Outer" members & t…
Browse files Browse the repository at this point in the history
…hen multipolygon

- revert changes from r18967
- simply close relation editor dialog for the already deleted relation instead of generating an additional delete command

git-svn-id: https://josm.openstreetmap.de/svn/trunk@18968 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information
GerdP authored and GerdP committed Feb 2, 2024
1 parent b7eabbb commit d34b858
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ public class GenericRelationEditor extends RelationEditor implements CommandQueu
* Action for performing the {@link CancelAction}
*/
private final CancelAction cancelAction;
/**
* Action for performing the {@link DeleteCurrentRelationAction}
*/
private final DeleteCurrentRelationAction deleteAction;
/**
* A list of listeners that need to be notified on clipboard content changes.
*/
Expand Down Expand Up @@ -269,7 +265,7 @@ public Collection<OsmPrimitive> getSelection() {
// Action for performing the {@link DuplicateRelationAction}
final DuplicateRelationAction duplicateAction = new DuplicateRelationAction(actionAccess);
// Action for performing the {@link DeleteCurrentRelationAction}
deleteAction = new DeleteCurrentRelationAction(actionAccess);
final DeleteCurrentRelationAction deleteAction = new DeleteCurrentRelationAction(actionAccess);

this.memberTableModel.addTableModelListener(applyAction);
this.tagEditorPanel.getModel().addTableModelListener(applyAction);
Expand Down Expand Up @@ -409,7 +405,6 @@ protected static JToolBar buildToolBar(AbstractRelationEditorAction... actions)
/**
* builds the panel with the OK and the Cancel button
* @param okAction OK action
* @param deleteAction Delete action
* @param cancelAction Cancel action
*
* @return the panel with the OK and the Cancel button
Expand Down Expand Up @@ -1081,7 +1076,6 @@ public AutoCompletingTextField getTextFieldRole() {

@Override
public void commandChanged(int queueSize, int redoSize) {
deleteAction.updateEnabledState();
Relation r = getRelation();
if (r != null && r.getDataSet() == null) {
// see #19915
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

import org.openstreetmap.josm.actions.mapmode.DeleteAction;
import org.openstreetmap.josm.data.osm.Relation;
import org.openstreetmap.josm.gui.MainApplication;
import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor;
import org.openstreetmap.josm.gui.dialogs.relation.RelationDialogManager;
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
import org.openstreetmap.josm.tools.ImageProvider;

/**
Expand All @@ -35,13 +38,20 @@ public void actionPerformed(ActionEvent e) {
Relation toDelete = getEditor().getRelation();
if (toDelete == null)
return;
if (toDelete.isDeleted()) {
// see #23447
OsmDataLayer layer = MainApplication.getLayerManager().getEditLayer();
if (layer != null) {
RelationDialogManager.getRelationDialogManager().close(layer, toDelete);
}
return;
}
DeleteAction.deleteRelation(getLayer(), toDelete);
}

@Override
public void updateEnabledState() {
Relation r = getEditor().getRelation();
setEnabled(r != null && !r.isDeleted());
protected void updateEnabledState() {
setEnabled(getEditor().getRelationSnapshot() != null);
}

@Override
Expand Down

0 comments on commit d34b858

Please sign in to comment.