Page 1 of 1

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

Posted: Thu Dec 04, 2025 6:39 pm
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

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

Posted: Thu Dec 04, 2025 8:02 pm
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

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

Posted: Fri Dec 05, 2025 7:47 am
by TassyJim
Same thing happens with PB6.21

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

Posted: Fri Dec 05, 2025 1:53 pm
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