PBv6.30b4 - The IDE closes when an open file is overwritten.

Raspberry PI specific forum
PeDe
Enthusiast
Enthusiast
Posts: 322
Joined: Sun Nov 26, 2017 3:13 pm

PBv6.30b4 - The IDE closes when an open file is overwritten.

Post by PeDe »

PB v6.30b4 arm64, Raspberry Pi OS (Trixie, Wayland)

The IDE closes when overwriting an open file with another file.

1. Open a saved file.
2. Create a new file or open another file.
3. Overwrite the first file opened with ‘Save as...’.
4. The following dialog box appears:
The file you specified is currently open in the IDE!
Do you want to close that tab and overwrite it?
No Yes
5. The IDE closes upon confirmation.

The file has not been overwritten.

Can anyone confirm this?

Peter
PeDe
Enthusiast
Enthusiast
Posts: 322
Joined: Sun Nov 26, 2017 3:13 pm

Re: PBv6.30b4 - The IDE closes when an open file is overwritten.

Post by PeDe »

The IDE crashes when:

[19:57:19] [ERROR] SourceManagement.pb (Line: 2465)
[19:57:19] [ERROR] DeleteElement(): Cannot delete a pushed current element.

Code: Select all

  If DeleteCurrent
    Index = ListIndex(FileList())
    If Index = 0
      DeleteElement(FileList())
      FirstElement(FileList())
    Else
      DeleteElement(FileList())
    EndIf
    *ActiveSource = 0
  Else
    PushListPosition(FileList())
    ChangeCurrentElement(FileList(), *Source)
    Index = ListIndex(FileList())
    DeleteElement(FileList())  ; <<<--- ERROR Line 2465
    PopListPosition(FileList())
  EndIf
Peter
TassyJim
Enthusiast
Enthusiast
Posts: 193
Joined: Sun Jun 16, 2013 6:27 am
Location: Tasmania (Australia)

Re: PBv6.30b4 - The IDE closes when an open file is overwritten.

Post by TassyJim »

Same thing happens with PB6.21
PeDe
Enthusiast
Enthusiast
Posts: 322
Joined: Sun Nov 26, 2017 3:13 pm

Re: PBv6.30b4 - The IDE closes when an open file is overwritten.

Post by PeDe »

Thanks for testing.
It is a logical error that occurs in the procedure ‘SourceManagement.pb->SaveSourceAs()’. It should therefore affect all PB versions, regardless of the operating system.
I have changed the IDE code for a test, and everything is currently working.

Peter

Code: Select all

  If DeleteCurrent
    Index = ListIndex(FileList())
    If Index = 0
      DeleteElement(FileList())
      FirstElement(FileList())
    Else
      DeleteElement(FileList())
    EndIf
    *ActiveSource = 0
  Else
;     PushListPosition(FileList())
    If @FileList() <> *Source
      PushListPosition(FileList())
      PopList = 1
    EndIf
    ChangeCurrentElement(FileList(), *Source)
    Index = ListIndex(FileList())
;     DeleteElement(FileList())
    If Not DeleteElement(FileList())
      FirstElement(FileList())
    EndIf
;     PopListPosition(FileList())
    If PopList
      PopListPosition(FileList())
     EndIf
  EndIf
Post Reply