delphidabbler / codesnip

A code bank designed with Pascal in mind
https://delphidabbler.com/software/codesnip
Other
110 stars 33 forks source link

CodeSnip crashes after resume from hibernation #70

Open delphidabbler opened 1 year ago

delphidabbler commented 1 year ago

When CodeSnip is running and Windows is hibernated and resumed CodeSnip crashes with an unrecoverable exception.

Selecting "Terminate" sometimes results in an endless loop and the process has to be killed with task manager.

delphidabbler commented 1 year ago

This is a long standing, intractable bug. Dunno why it didn't make it into issues until now.

I suspect it's something to do with the web browser control, but haven't confirmed it. (❌😊 probably not see https://github.com/delphidabbler/codesnip/issues/70#issuecomment-1352701786)

delphidabbler commented 1 year ago

Just tried 5 hibernations with CodeSnip running from the Delphi XE debugger and stand-alone and not a single crash.

⚠️ This is going to be hard to track down!

delphidabbler commented 1 year ago

Crash happened today while debugging.

A stack trace indicates that that exception is a fault reading a zero pointer in the Overview pane. The culprit would appear to be an IView (non)instance.

I think I'd never selected anything in the Overview pane before the crash, which could explain the null pointer exception.

delphidabbler commented 1 year ago

Had another crash under the debugger.

Crash is reported as occurring in line

Result := ViewItem.IsUserDefined;

Stack trace is (method followed by indented line in method, where available), with method raising exception listed at top:

TOverviewFrame.TTVDraw.IsUserDefinedNode
    Result := ViewItem.IsUserDefined;
TSnippetsTVDraw.CustomDrawItem
    TV.Canvas.Font.Color :=
      Preferences.DBHeadingColours[IsUserDefinedNode(Node)];
TCustomTreeView.CustomDrawItem
TCustomTreeView.CNNotify
TControl.WndProc
TWinControl.WndProc
TCustomTreeView.WndProc
DoControlMsg
TWinControl.WndProc
TWinControl.MainWndProc
StdWndProc
{various calls into user32 & common controls library}
TWinControl.DefaultHandler
TWinControl.WndProc
TCustomTreeView.WndProc
StdWinProc
{various calls into user32}
TTreeNode.SetText
TTreeNodes.ReadNodeData
TCustomTreeView.CreateWnd
TWinControl.CreateHandle
TWinControl.UpdateControlState
TWinControl.CMRecreateWnd
TControl.WndProc
TWinControl.WndProc
TCustomTreeView.WndProc
TWinControl.RecreateWnd
TWinControl.WndProc
TCustomTreeView.WndProc