View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0038544 | Lazarus | LCL | public | 2021-02-25 15:25 | 2021-03-05 12:19 |
Reporter | CudaText man | Assigned To | Juha Manninen | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 2.1 (SVN) | ||||
Summary | 0038544: Poor crash message if exception occurs in OnTimer | ||||
Description | Lazarus 2.1.0 r64665 FPC 3.2.1 x86_64-linux-gtk2 run attached demo w/o debugging. expected: message with text which I pass to TException.Create() reality: it shows poor message about error. only "Access violation". | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r64745 | ||||
LazTarget | - | ||||
Widgetset | GTK 2 | ||||
Attached Files |
|
|
|
|
Exception and Access violation are 2 different things. Access violation is always wrong and means you should fix the code. Looks like yet another crappy bug report. |
|
I have reported (on ML I think) similar problems with raising exceptions in an OnTimer event on Windows. Currently if I raise an exception in an OnTimer event, the exception does NOT bubble up. Nothing happens at all, the program simply continues. Just a simple form with a button and a timer. procedure TForm1.FormCreate(Sender: TObject); begin end; procedure TForm1.Timer1Timer(Sender: TObject); begin writeln('Timer1: raising an exception'); raise exception.create('foo'); end; procedure TForm1.Button1Click(Sender: TObject); begin Timer1.Enabled := True; end; It will continously spit out: Timer1: raising an exception Timer1: raising an exception Timer1: raising an exception Timer1: raising an exception Timer1: raising an exception Timer1: raising an exception Timer1: raising an exception Timer1: raising an exception etc. etc. |
|
Running the same program from my note abov on Linux GTK2 gives exactly the errormessage that is attached to this bugreport. |
|
Juha, no, not crap report, look at the demo code. I must see my own exception. in reality I see "AV". |
|
customtimer.pas: CustomApplication is nil. procedure TCustomTimer.Timer; begin {$IFDEF VerboseTimer} DebugLn(['TCustomTimer.Timer ',dbgsName(Self),' ',FEnabled,' ',FInterval]); {$ENDIF} if (FEnabled) and (FInterval > 0) then try DoOnTimer; except CustomApplication.HandleException(nil); end; end; |
|
added the fix! note - 'Forms' must be used in 'implementation'. (otherwise- circular reference). fix.diff (669 bytes)
Index: lcl/customtimer.pas =================================================================== --- lcl/customtimer.pas (revision 64723) +++ lcl/customtimer.pas (working copy) @@ -20,7 +20,7 @@ interface uses - Classes, SysUtils, LCLProc, LCLStrConsts, LCLType, InterfaceBase, CustApp; + Classes, SysUtils, LCLProc, LCLStrConsts, LCLType, InterfaceBase; type @@ -56,6 +56,9 @@ implementation +uses + Forms; + const cIdNoTimer = THandle(-1); { timer ID for an invalid timer } @@ -150,7 +153,7 @@ try DoOnTimer; except - CustomApplication.HandleException(nil); + Application.HandleException(nil); end; end; |
|
Ok, it was a real bug. I synchronized CustomApplication with Application instead of using variable Application and creating a circular reference. I think it is logically correct. Please test. |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-02-25 15:25 | CudaText man | New Issue | |
2021-02-25 15:25 | CudaText man | File Added: err.png | |
2021-02-25 15:25 | CudaText man | File Added: tst-timer-crash.zip | |
2021-02-25 15:51 | Juha Manninen | Note Added: 0129160 | |
2021-02-25 16:01 | Juha Manninen | Note Edited: 0129160 | View Revisions |
2021-02-25 20:45 | Bart Broersma | Note Added: 0129164 | |
2021-02-25 20:52 | Bart Broersma | Note Added: 0129165 | |
2021-02-25 21:44 | CudaText man | Note Added: 0129167 | |
2021-02-25 21:46 | CudaText man | Note Edited: 0129167 | View Revisions |
2021-02-26 13:24 | delfion | Note Added: 0129170 | |
2021-03-02 18:09 | CudaText man | Note Added: 0129326 | |
2021-03-02 18:09 | CudaText man | File Added: fix.diff | |
2021-03-05 09:08 | Juha Manninen | Assigned To | => Juha Manninen |
2021-03-05 09:08 | Juha Manninen | Status | new => assigned |
2021-03-05 11:01 | Juha Manninen | Status | assigned => resolved |
2021-03-05 11:01 | Juha Manninen | Resolution | open => fixed |
2021-03-05 11:01 | Juha Manninen | Fixed in Revision | => r64745 |
2021-03-05 11:01 | Juha Manninen | LazTarget | => - |
2021-03-05 11:01 | Juha Manninen | Widgetset | GTK 2 => GTK 2 |
2021-03-05 11:01 | Juha Manninen | Note Added: 0129396 | |
2021-03-05 12:19 | CudaText man | Status | resolved => closed |