Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access violation while changing the theme #1234

Closed
tim-lebedkov opened this issue Jan 11, 2024 · 3 comments
Closed

Access violation while changing the theme #1234

tim-lebedkov opened this issue Jan 11, 2024 · 3 comments
Labels
Milestone

Comments

@tim-lebedkov
Copy link

tim-lebedkov commented Jan 11, 2024

I updated Virtual TreeView to 7.6.5a and started getting this exception while changing the theme from default Windows to "Light". The program is compiled in XE5.

[0000000000E05382] VirtualTrees.StyleHooks.TVclStyleScrollBarsHook.Destroy (Line 520, "VirtualTrees.StyleHooks.pas")
[000000000040E4C8] System.TObject.Free
[0000000000FFA876] Vcl.Styles.TStyleEngine.DoRemoveControl
[0000000000FFADBF] Vcl.Styles.TStyleEngine.Notification
[00000000007E6F7F] Vcl.Themes.TStyleManager.Notification
[00000000007B0D79] Vcl.Controls.TWinControl.WMDestroy
[000000000040EBD1] System.TObject.Dispatch
[00000000007A6566] Vcl.Controls.TControl.WndProc
[00000000007ADC33] Vcl.Controls.TWinControl.WndProc
[0000000000E706AF] VirtualTrees.TBaseVirtualTree.WndProc (Line 25893, "VirtualTrees.pas")
[00000000007ACE6C] Vcl.Controls.TWinControl.MainWndProc
[0000000000552A36] System.Classes.StdWndProc
[00007FF8BD45E858] Unknown function at CallWindowProcW
[00007FF8BD45E3DC] Unknown function at DispatchMessageW
[00007FF8BD470C93] Unknown function at SendMessageTimeoutW
[00007FF8BEDF0E64] KiUserCallbackDispatcher
[00007FF8BC8C2384] NtUserDestroyWindow
[00000000007AC580] Vcl.Controls.TWinControl.DestroyWindowHandle
[00000000007AC514] Vcl.Controls.TWinControl.DestroyWnd
[00000000007AC8F2] Vcl.Controls.TWinControl.DestroyHandle
[00000000007AC8AA] Vcl.Controls.TWinControl.DestroyHandle
[0000000000757D30] Vcl.Forms.TCustomForm.DestroyHandle
[00000000007AC978] Vcl.Controls.TWinControl.CMRecreateWnd
[000000000040EBD1] System.TObject.Dispatch
[00000000007A6566] Vcl.Controls.TControl.WndProc
[00000000007ADC33] Vcl.Controls.TWinControl.WndProc
[0000000000754960] Vcl.Forms.TCustomForm.WndProc
[0000000000D6F568] JvDockControlForm.TJvDockBaseControl.WindowProc (Line 2484, "JvDockControlForm.pas")
[0000000000D722C7] JvDockControlForm.TJvDockClient.WindowProc (Line 3584, "JvDockControlForm.pas")
[00000000007A6042] Vcl.Controls.TControl.Perform
[0000000000754850] Vcl.Forms.TCustomForm.WndProc
[0000000000D6F568] JvDockControlForm.TJvDockBaseControl.WindowProc (Line 2484, "JvDockControlForm.pas")
[0000000000D722C7] JvDockControlForm.TJvDockClient.WindowProc (Line 3584, "JvDockControlForm.pas")
[00000000007ACE6C] Vcl.Controls.TWinControl.MainWndProc
[0000000000552A36] System.Classes.StdWndProc
[00007FF8BD45E858] Unknown function at CallWindowProcW
[00007FF8BD45DE1B] Unknown function at SendMessageW
[00007FF8BD45D68A] SendMessageW
[00000000007E7521] Vcl.Themes.TStyleManager.SetStyle
[00000000007E7A2A] Vcl.Themes.TStyleManager.TrySetStyle

@tim-lebedkov
Copy link
Author

In the following method FVertScrollWnd is nil, but Self is not nil:

destructor TVclStyleScrollBarsHook.Destroy;
begin
  FVertScrollWnd.StyleHook := nil;
  FreeAndNil(FVertScrollWnd);
  FHorzScrollWnd.StyleHook := nil;
  FreeAndNil(FHorzScrollWnd);
  inherited;
end;

@joachimmarder
Copy link
Contributor

Well, I no more have a Delphi XE5 at hand, but I remember that at least in XE2 - XE5 the VCL style code was not the best. Besides updating to a newer Delphi version, you can try if simply adding assign checks solves the problem:

destructor TVclStyleScrollBarsHook.Destroy;
begin
  if Assigned(FVertScrollWnd) then
  begin
    FVertScrollWnd.StyleHook := nil;
    FreeAndNil(FVertScrollWnd);
  end;
  if Assigned(FHorzScrollWnd) then
  begin
    FHorzScrollWnd.StyleHook := nil;
    FreeAndNil(FHorzScrollWnd);
  end;
  inherited;
end;

If so, I will add this change.

@tim-lebedkov
Copy link
Author

The change helps. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants