I have found infrequent but recurring problems with InspectorBar.pas, where there are a number of Procedures that process FeditItem in various ways. Both I and a number of customers have had problems where FeditItem is nil when these procedures are called - which causes a crash. This is so prevalent I modify InspectorBar.pas every time I get a revision. This has been going on for some years but I did not mention it as I thought it was probably the result of my bad programming elsewhere. But the latest occurrence happened during startup and never came anywhere near any of my code.
What I do is add:
if FEditItem = nil then exit;
as the first line of these Procedures:
procedure TInspectorBar.EditChanged(Sender: TObject);
procedure TInspectorBar.UpdateEdit);
procedure TInspectorBar.ComboChanged(Sender: TObject);
Is it possible to add this (or something similar) to these procedures?
We can adapt this but it would be better if we can reproduce this and find the real cause of why FEditItem = nil
I agree, and if I really have tried over the years, but it's one of those bugs that just 'sometimes happens'.
This is the main thread call stack from the latest encounter (EXE name changed to protect the innocent):
exception message : Access violation at address 000000000123EDBB in module 'Myprogram.exe'. Read of address 0000000100000058.
main thread ($189c):
0123edbb +01b Myprogram.exe InspectorBar 8704 +1 TInspectorBar.ComboChanged
00475639 +029 Myprogram.exe Vcl.StdCtrls TCustomCombo.Change
0047459f +05f Myprogram.exe Vcl.StdCtrls TCustomComboBox.Change
00475a97 +037 Myprogram.exe Vcl.StdCtrls TCustomCombo.Select
00475563 +1b3 Myprogram.exe Vcl.StdCtrls TCustomCombo.CNCommand
01205726 +016 Myprogram.exe InspEdits 880 +1 TInspCustomCombo.CNCommand
001722b1 +041 Myprogram.exe System TObject.Dispatch
0043a78d +35d Myprogram.exe Vcl.Controls TControl.WndProc
00441c42 +962 Myprogram.exe Vcl.Controls TWinControl.WndProc
00475399 +2b9 Myprogram.exe Vcl.StdCtrls TCustomCombo.WndProc
0047817e +2ae Myprogram.exe Vcl.StdCtrls TCustomComboBox.WndProc
0043a290 +030 Myprogram.exe Vcl.Controls TControl.Perform
00441e29 +029 Myprogram.exe Vcl.Controls DoControlMsg
00442fe3 +013 Myprogram.exe Vcl.Controls TWinControl.WMCommand
001722b1 +041 Myprogram.exe System TObject.Dispatch
0043a78d +35d Myprogram.exe Vcl.Controls TControl.WndProc
00441c42 +962 Myprogram.exe Vcl.Controls TWinControl.WndProc
01244aa8 +048 Myprogram.exe InspectorBar 10635 +11 TInspectorBar.WndProc
00440d7a +02a Myprogram.exe Vcl.Controls TWinControl.MainWndProc
0034acb3 +023 Myprogram.exe System.Classes StdWndProc
7ffd434b +01f ntdll.dll KiUserCallbackDispatcher
7ffd4234 +0d5 user32.dll SendMessageW
7ffd4234 +089 user32.dll CallWindowProcW
00441dbb +10b Myprogram.exe Vcl.Controls TWinControl.DefaultHandler
00442ff5 +025 Myprogram.exe Vcl.Controls TWinControl.WMCommand
001722b1 +041 Myprogram.exe System TObject.Dispatch
0043a78d +35d Myprogram.exe Vcl.Controls TControl.WndProc
00441c42 +962 Myprogram.exe Vcl.Controls TWinControl.WndProc
00475399 +2b9 Myprogram.exe Vcl.StdCtrls TCustomCombo.WndProc
0047817e +2ae Myprogram.exe Vcl.StdCtrls TCustomComboBox.WndProc
00440d7a +02a Myprogram.exe Vcl.Controls TWinControl.MainWndProc
0034acb3 +023 Myprogram.exe System.Classes StdWndProc
7ffd434b +01f ntdll.dll KiUserCallbackDispatcher
7ffd4234 +0d5 user32.dll SendMessageW
7ffd4234 +254 user32.dll DispatchMessageW
005d094e +12e Myprogram.exe Vcl.Forms TApplication.ProcessMessage
005d09c3 +013 Myprogram.exe Vcl.Forms TApplication.HandleMessage
005d0e1a +0ea Myprogram.exe Vcl.Forms TApplication.Run
01de746d +3ad Myprogram.exe Myprogram 176 +72 initialization
Sadly this doesn't say much about circumstances preceding the access to FEditItem that is nil
I thought that would be case but it is all I have!