BUG: NP++ preventing windows shutdown, all NP++ tabs will be killed.

  • Situation is many tabs open with unsaved documents. This happens when windows updates (but I’m not sure if that’s required). While shutting down, Notepad++ ends up preventing the shutdown, so I cancel the shutdown to address it. Notepad++ has a SaveAs popup, I hit “No” (since it was a scratch file). Notepad++ seems to almost crash, as it doesn’t ask to save for any other tab. When it reopens all the tabs are gone. No recovery possible.

    (I immediately try to repeat the problem and Notepad++ just closes and properly opens the tabs as unsaved documents, like I would expect.)

    This has been happening for a long time for many many versions.

  • welcome to the notepad++ community, @TroyS___

    please go to settings > preferences > multi-instance and set it to default (mono instance) if it is set differently, as seen at the screenshot below:


    also confirm that “remember current session for next launch” and “enable session snapshot and periodic backup” are enabled at settings > preferences > backup > session snapshot and periodic backups as seen at the next screenshot:

    settings - auto backup

    then try reproducing your experience with a simulated reboot, having an open notepad++ window with any combination of saved, new (never saved) and altered, unsaved files or new tabs or anything else you would like to try.

    important note: it is best to either close notepad++ when your pc is unused and in idle, if you don’t know when or if your machine will be rebooted automatically.
    or set windows update to manual reboot, as it will try to force kill your notepad++ after a few seconds without user action, and not give you or notepad++ time to save all it’s data when closing.

    explanation: the reason why the windows update reboot force kill attempt will not work immediately, as you have experienced, is because a save/save as popup, triggered by a graceful shutdown event, is still active.
    but once you have answered it, with either save or discard, the force kill will take action, killing notepad++ with no further save dialogues, as you have also experienced.

    the combination of “remember current session for next launch” and “enable session snapshot and periodic backup” will usually circumvent this missing time to save, by saving a “snapshot” of your data every 7 seconds, so once a reboot will happen, the data of all tabs is already saved to notepad++'s backup path.
    this works without actually saving over your original files.
    this is a feature to survive an unsaved reboot, without altering your original files, until you choose to save them yourself.

    the setting to “default (mono instance)” will avoid conflicts with inconsistent and missing snapshot data of more than one running notepad++ tasks, or multiple notepad++ tasks in process of being killed.

  • A Fix for This Bug

    I recently ran into a similar situation, when a power line went down in my neighborhood and there was no chance for a graceful shutdown. Even though I am on a laptop, the battery is barely usable, so the computer shut itself down by essentially DYING for lack of power.

    When I restarted NP++, all my tabs were gone.

    The Quicker Fix

    HERE’S A SUGGESTED FIX, in keeping with the information above:

    Add an item to the FILE menu between “Load Session” and “Save Session” - that new item should read “Load Session from Backup” and should trigger the OPEN dialog box to open to the location specified in the Preferences_Dialog>Backup>Backup Path field.

    If you will check that location, you will probably find you have multiple session backups stored there. Triggering the OPEN session dialog box to open to the backup location will allow us to see all those session backups and select the one we want.

    The More Involved (But Better) Fix:

    • Develop a NEW “Sessions” Dialog
    • Replace the current File>Load Session and Save Session menu items with a single
      menu item “Session” that opens this dialog.
    • Move the “Session snapshot…” elements from the Preferences > Backup area to the Sessions
      dialog; replace these elements with a button that opens the dialog (which will accommodate
      users who look for these elements there)
    • To the SESSIONS dialog, add
      ** A Field “Current Session Name” - this could be combined with backup path, but would
      probably be better as a separate field, with a read-only line below the field showing the
      entire backup path-and-filename combination
      ** A manual “Save Session Now” button; although if we are doing an auto session backup
      every 7 seconds, this might not be necessary.
      ** A manual “Load Current Session” button
      ** A manual “Load Different Session” button - this would trigger the Open Session dialog,
      which would default to the Backup Path indicated above.

    Problem Solved

    With a solution such as that indicated in the “More Involved (But Better) Fix” section above, there would be no need for anyone ever again to lose all their tabs.

    Hope this helps, and I hope even more someone more fluent in coding finds this to be a good idea and can implement it.

    – David in Mississippi –

  • Okay, here is my sketch of what the SESSIONS MANAGEMENT DIALOG should look like:

    NotePad++ SESSIONS MANAGEMENT Dialog Box (Concept)

    Hope this helps someone actually BUILD this thing for us!

    – David in Mississippi –

  • when a power line went down in my neighborhood and there was no chance for a graceful shutdown.

    People…Name your files…Save (use the command) often. Jeez.

Log in to reply