Skip to content

No confirmation on closing window with unsaved changes #862

Closed
@per1234

Description

@per1234

Describe the bug

Unsaved changes to the sketch will be lost when closing the window. For this reason, the IDE must request confirmation from the user before proceeding, as is the standard convention for any application.

🐛 The IDE closes without confirmation even when the sketch has unsaved changes. This may cause loss of data for users who expect the standard "save and quit" behavior.

To Reproduce

  1. Open any sketch.
  2. Select File > Preferences... from the Arduino IDE menus.
  3. Uncheck the box next to "🗹 Auto save".
  4. Click the OK button.
  5. Make any change to the sketch.
    ❗ Do not save the sketch.
  6. Select File > Close from the Arduino IDE menus.

🐛 The window closes immediately and all unsaved changes are lost.

Expected behavior

Confirmation dialog when closing IDE window with unsaved changes.

Desktop

Original

  • OS: Windows 10, Ubuntu 20.04
  • Version: 2.0.0-rc4-snapshot-0207778
    Date: 2022-02-23T15:40:32.443Z
    CLI Version: 0.21.0 [10107d24]

Last verified with

  • OS: Windows 10, Ubuntu 20.04
  • Version: 2.0.0-rc4-snapshot-70f1c5f
    Date: 2022-03-09T10:47:19.505Z
    CLI Version: 0.21.0 [10107d24]

Additional context

I bisected the bug to 112153f (it does not occur when using the build from the previous commit 69ac1f4).


The bug occurs no matter which method you use to close the window:

  • File > Close
  • File > Quit
  • Native window close control

The bug also occurs with new sketches that have unsaved changes when the sketch is closed by these methods:

  • File > Quit
  • Native window close control

(There is a dialog on File > Close with a new dirty sketch)


Originally reported by @UKHeliBob at https://forum.arduino.cc/t/no-prompt-to-save-a-modified-file-when-closing-the-ide/962323

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions