0

在阅读了这个问题之后,我试图让最终用户在运行时更改我的应用程序的样式。这导致了长的内存泄漏列表,内容如下:

A memory block has been leaked. The size is: 12

This block was allocated by thread 0x130C, and the stack trace (return addresses) at
the time was: 404B3E [frxDsgnIntf.pas][System][@GetMem$qqri][1993] 454B77
[System.SysUtils][Sysutils.WideStrAlloc$qqrui] 454BB2 [System.SysUtils]
Sysutils.StrNew$qqrpxb] 53046E [Vcl.Controls][Controls.TWinControl.DestroyWnd$qqrv]
57E1C7 [Vcl.ComCtrls][Comctrls.TCustomTreeView.DestroyWnd$qqrv] A53DEE [JvComCtrls]
TJvTreeView.DestroyWnd$qqrv] 530733 [Vcl.Controls]
Controls.TWinControl.DestroyHandle$qqrv] 530703 [Vcl.Controls]
Controls.TWinControl.DestroyHandle$qqrv] 530703 [Vcl.Controls]
Controls.TWinControl.DestroyHandle$qqrv] 7552FEB6 [EnumThreadWindows] 530703
[Vcl.Controls][Controls.TWinControl.DestroyHandle$qqrv]

The block is currently used for an object of class: Unknown

几乎所有的泄漏都在 中frxDsgnIntf.pas,除了表单上允许用户更改样式的所有组件并且都指向此过程:

with TdlgSettings.Create(nil) do // leak here according to FastMM report
  try
    if ShowModal = mrOk then;
  finally
    Release;
  end;

有谁知道我做错了什么,或者这是改变风格时的预期行为?TStyleManager这是在运行时更改样式的代码:

procedure TdlgSettings.cbThemeChange(Sender: TObject);
begin
  TStyleManager.TrySetStyle(cbTheme.Text); // cbTheme.Items lists all the themes which are included the application
end;
4

1 回答 1

0
uses
Vcl.Styles, Vcl.Themes,
uFixMemOverflowVclStyle; 

链接:http ://www.delphi4arab.net/forum/showthread.php?t=9607

于 2014-04-08T07:09:32.283 回答