Opened 3 years ago
Last modified 3 years ago
#22817 closed defect
[patch] No warning deleting a data layer with changes and discouraged upload set — at Version 2
| Reported by: | skyper | Owned by: | team |
|---|---|---|---|
| Priority: | major | Milestone: | 23.04 |
| Component: | Core | Version: | latest |
| Keywords: | template_report modified data layer discouraged state save | Cc: |
Description (last modified by )
What steps will reproduce the problem?
- Download new data
- Make some changes
- Set "discourage upload" on the layer
- Delete layer
What is the expected result?
Upload/Save dialog with upload disabled
What happens instead?
Layer is deleted without any warning
Please provide any additional information below. Attach a screenshot if possible.
Did not try upload=never but the dialog should still be displayed.
Relative:URL: ^/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2023-03-13 21:59:27 +0100 (Mon, 13 Mar 2023) Revision:18690 Build-Date:2023-03-14 02:30:58 URL:https://josm.openstreetmap.de/svn/trunk
Change History (2)
comment:1 by , 3 years ago
| Priority: | normal → critical |
|---|
comment:2 by , 3 years ago
| Description: | modified (diff) |
|---|---|
| Milestone: | → 23.03 |
| Priority: | critical → major |
| Summary: | No warning deleting a data layer with changes and discouraged upload set → [patch] No warning deleting a data layer with changes and discouraged upload set |
-
src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
112 112 public static boolean saveUnsavedModifications(Iterable<? extends Layer> selectedLayers, Reason reason) { 113 113 if (!GraphicsEnvironment.isHeadless()) { 114 114 SaveLayersDialog dialog = new SaveLayersDialog(MainApplication.getMainFrame()); 115 List<AbstractModifiableLayer> layersWithUn modifiedChanges = new ArrayList<>();115 List<AbstractModifiableLayer> layersWithUnsavedChanges = new ArrayList<>(); 116 116 for (Layer l: selectedLayers) { 117 117 if (!(l instanceof AbstractModifiableLayer)) { 118 118 continue; … … 121 121 if (odl.isModified() && 122 122 ((!odl.isSavable() && !odl.isUploadable()) || 123 123 odl.requiresSaveToFile() || 124 (odl.requiresUploadToServer() && !odl.isUploadDiscouraged()))) {125 layersWithUn modifiedChanges.add(odl);124 odl.requiresUploadToServer())) { 125 layersWithUnsavedChanges.add(odl); 126 126 } 127 127 } 128 128 dialog.prepareForSavingAndUpdatingLayers(reason); 129 if (!layersWithUn modifiedChanges.isEmpty()) {130 dialog.getModel().populate(layersWithUn modifiedChanges);129 if (!layersWithUnsavedChanges.isEmpty()) { 130 dialog.getModel().populate(layersWithUnsavedChanges); 131 131 dialog.setVisible(true); 132 132 switch(dialog.getUserAction()) { 133 133 case PROCEED: return true;
The upload=never option is not affected as in that case the isUploadable() returns false anyway.
I renamed the layersWithUnmodifiedChanges local variable to something more meaningful because the current naming contradicts.
Also whoever commits, the !odl.isSavable() && !odl.isUploadable() seems suspicious. When does it happen?



With current behavior, you can loose all you work, e.g. a private file of all you mushroom spots.