Am Lazarus 3.6 on Linux Mint 21.1
Please consider the following simple code:
procedure TFrmAppointments.FCmdRestoreClick(Sender: TObject);
VAR
VLOC_OpenDialog : tOpenDialog;
VLOC_BackUpFileName : tFileName;
begin
FLog('TFrmAppointments.FCmdRestoreClick: entered');
IF MessageDlg('my app', 'are you sure?', mtConfirmation, [mbYes, mbNo], 0) = mrYes THEN BEGIN // Point (1)
VLOC_OpenDialog := tOpenDialog.Create(NIL);
VLOC_OpenDialog.DefaultExt := '.bdb'; //ATC_DefaultRescueExtension;
VLOC_OpenDialog.InitialDir := '.'; // ATV_RootDirectory;
// VLOC_OpenDialog.Options := [];
VLOC_OpenDialog.Title := 'please select backup file';
IF VLOC_OpenDialog.Execute THEN BEGIN // Point (2)
VLOC_BackupFileName := VLOC_OpenDialog.FileName;
...
Code is supposed to use an OpenDialog instance to get a file name. Nothing really serious.
Problem is application terminates unexpectedly before Point (2) is executed. Have confirmed that every intermediate sentence setting the OpenDialog is executed. However dialog is not launched by
VLOC_OpenDialog.Execute and no exception is raised.
App simply dies.A few things that puzzle me, from the inspection conducted:
1. If Point (1) elementary dialog is omitted, then Point (2) is executed without issues. Seems problem appears at Point (2) but that it is Point (1) related. Have replaced
MessageDlg with other elementary dialogs,
problem remained.
2. Instead of creating a local instance of a tOpenDialog, have placed a tOpenDialog component directly on the tFrmAppointments,
problem remained.
3. Have tested removing intermediate statements between Point (1) and Point (2) with the exception of the VLOC_OpenDialog.Create one,
no improvement.
4. If I set a debugger break point at Point (2),
code executes well under the debugger! Some thirty years ago, I used to have a similar issue on an application I had been writing using Visual Basic, I could not solve in the end. Turned to Delphi after this.
5. Have ported app to Windows XP (on a virutal machine I have, with Lazarus 3.6 for Windows installed), code works well without changes!
Apparently this is a Linux version issue.
Does this look like a bug of either Lazarus or FPC on Linux?
regards
s