TMenuItem crashes (randomly) on WinMe
Original Reporter info from Mantis: Bart @flyingsheep
-
Reporter name: Bart Broersma
Original Reporter info from Mantis: Bart @flyingsheep
- Reporter name: Bart Broersma
Description:
A TMenuItem (on a TForm) crashes the application on WinMe in an unpredictable way. That is, it sometimes crashes.
Window shuts the app down with: "program has caused an error in KERNEL32.DLL. program will be closed." (Translated back from Dutch).
I decided to set the severity to major, because this bug prevents me from writing (porting) any serious app in (to) Lazarus.
Steps to reproduce:
Put a mainmenu on a TForm. Add one TMenuItem to it.
Compile and run (repeatedly, up to > 100 times...).
Additional information:
When the app crashes, this is the output in the console:
[FORMS.PP] ExceptionOccurred
Sender=EAccessViolation
Exception=Access violation
Stack trace:
$004D36B6 WINDOWPROC, line 1433 of win32callback.inc
$BFF63613
$BFF848F7
$0119847A
TApplication.HandleException Access violation
Stack
I once succeeded in crashing it in gdb, then gdb said:
Program received signal SIGSEGV, Segmentation fault.
0x004da696 in WINDOWPROC (WINDOW=1352, MSG=43, WPARAM=0, LPARAM=19199132)
at win32callback.inc:1433
1433 win32callback.inc: No such file or directory.
in win32callback.inc
The program is compiled with all optimizations off and rangechecking, stackchecking and overflowchecking on.
From win32callback.inc:
function WindowProc(Window: HWnd; Msg: UInt; WParam: Windows.WParam;
LParam: Windows.LParam): LResult; stdcall;
.....
// TODO: this could crash for a MenuItem.
WindowInfo := GetWindowInfo(PDrawItemStruct(LParam)^.hwndItem);
--> if WindowInfo^.WinControl<>nil then <-- this is line 1433
lWinControl := WindowInfo^.WinControl;
Somebody wrote the comment "This could crash for a TMenuItem", well (s)he seems to be rigth?
Some other things I observed.
Putting more controls on the form, seems to make the app crash more often.
I derived the attached app from a more elaborate program, painfully stripping it down to the barest minimum and running it endlessly.
I did not checkout the compiled program on Win98 or WinXP, I will report back on that once I did.
Mantis conversion info:
- Mantis ID: 11087
- OS: WinMe
- OS Build: MS
- Build: 14480
- Platform: i386
- Version: 0.9.25 (SVN)
- Fixed in version: 0.9.29 (SVN)
- Fixed in revision: 25233 (#19470fe5)
- Target version: 1.0.0
- LazTarget: 1.0