Recent

Author Topic: PC shutdown without closing Lazarus  (Read 410 times)

bobby100

  • Full Member
  • ***
  • Posts: 161
    • Malzilla
PC shutdown without closing Lazarus
« on: March 26, 2023, 07:38:02 pm »
Today, I've left my laptop on, with Lazarus running. When the battery got empty, the Windows 10 did a shutdown, just as expected.

After starting the laptop again, the Lazarus installation was messed up to the point that I could not start Lazarus anymore. I got the dialog where it says something about the configuration, and at clicking on Next it just got stuck (tried á couple of times).
Installing Lazarus over the existing installation didn't help.

Next step, rename the directory c:\Users\{user_name}\AppData\Local\lazarus\ got me to the clean Lazarus without my settings and installed components.
Inspecting the old files (before re-installing Lazarus) from that directory - the file environmentoptions.xml was 64kb in size, but full of zeros. Other files in the directory seems to be OK.

I wish that Lazarus could be more resistant to such forced shutdowns.
https://gitlab.com/bobby100 - my Lazarus components and units
https://sourceforge.net/u/boban_spasic/profile/ - my open source apps

https://malzilla.org/ - remainder at my previous life as a web security expert

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: PC shutdown without closing Lazarus
« Reply #1 on: March 26, 2023, 08:46:02 pm »
I suppose Laz should at least do an auto save at that point, at least if you are working on a ready started project, not something you haven't even saved with a new name yet.
The only true wisdom is knowing you know nothing

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: PC shutdown without closing Lazarus
« Reply #2 on: March 26, 2023, 09:46:43 pm »
A file full of #0 would imho imply that the IDE tried to write the file, but never got to finish it.

The file is afaik normally read on start, but not held open. So if Lazarus had just been killed, without writing the file, then the file should be fine.
It must have tried to write it (be that because of the shutdown or other).

Since it can happen that writing a file fails, maybe it should rename the old file first to a backup. Then something to restore would exist....

 

TinyPortal © 2005-2018