Jump to content
Sue King

FastMM4.992 and FMX Styles loaded at runtime

Recommended Posts

I have just upgraded from Delphi 10.3 to 10.4.  I have been using FastMM 4.992 in my projects.

 

The main form has an initialization

 

  ReportMemoryLeaksOnShutdown := True;
  TfrmMain.SetMyStyle;

 

SetMyStyle is defined

 

class procedure TfrmMain.SetMyStyle;
var
  sStyleFile: string;
  bOK: Boolean;
  sPath: string;
begin
  sStyleFile := 'C:\DevFolder\21.0\bin\Win32\Debug\Styles\Calypso_Win.style';
  if TFile.Exists(sStyleFile) then
  begin
    bOK := TStyleManager.SetStyleFromFile(sStyleFile);
  end;
end;

 

In 10.3 this works without any issues.

In 10.4, FastMM4 generates an AV on closedown

 

FastMM has detected an attempt to call a virtual method on a freed object.  An access violation will now be raised in order to abort the current operation. Unfortunately the block header has been corrupted so no history is available.

 

The current thread ID is 0x27F4 and the stack trace (return addresses) leading to this error is:

6DCB67

{FMX.Controls.pas][FMX.Conrols.TControl.Repaint][3547]

76A260

FMX.Styles.Objects.pas][FMX.Styles.Objects][Styles.OBjects.TButtonStyleObject.NormalTriggered][2357]

 

....

 

I have GExperts install, and it generats a message

Project xx.exe raised exception EAccessVioloation with message 'Access Violation at address 776B4662. Read of address 00000000'.

 

This is in a new project, which has no components on the form.  The only changes to the default new project are the uses in the dpr for FastMM, the class procedure, initialization and addition uses in the main form for FMX.Styles and System.IOUtils.

 

The options I have changed in FastMM4Options.inc are

 

 {$define NeverUninstall}

 {$define UseRuntimePackages}

 {$define NoDebugInfo}

 {$define FullDebugMode}

 {$define CatchUseOfFreedInterfaces}

 {$define ClearLogFileOnStartup}

 {$define DisableLoggingOfMemoryDumps}

 {$define HideMemoryLeakHintMessage}

 

The style I am using is Calypso_Win.style.  This is one of the premium styles available through Getit.

 

Does anyone have any idea of where I should be looking for the problem.

 

Sue

 

 

 

 

Share this post


Link to post

The issue is the use of Premium styles.  Standard styles do not cause an error.

Share this post


Link to post

For anyone who has this issue, it relates to the windowborderstyle in the .style file.  If the client object is deleted there is no AV on closedown. 

Another work around is to set Border-> Styling = False for the form.  It does look odd though.

So now to find out how to change the colour of the window border without this element, or create a similar element that doesn't have the issue.

Share this post


Link to post
Guest
7 hours ago, Sue King said:

For anyone who has this issue, it relates to the windowborderstyle in the .style file.  If the client object is deleted there is no AV on closedown. 

Another work around is to set Border-> Styling = False for the form.  It does look odd though.

So now to find out how to change the colour of the window border without this element, or create a similar element that doesn't have the issue.

With -- Tools, Bitmap Editor you can open the Styles files!

  • Just search what you want change!

Share this post


Link to post

Thank you for pointing this out.

 

I will see what I can do with it tomorrow. 

 

Maybe comparing styles that have the problem and those that don't will help me resolve the issue.

 

Share this post


Link to post
Guest

 

// VCL.Themes.pas, line 5654 call:  
LStyleServicesClass := FindStyleDescriptor(ExtractFileExt(FileName), dfExtension).StyleClass;

// in FMX.Styles.TStyleManager.FindStyleDescriptor
Returns the style description of the specified style. 

FindStyleDescriptor returns the TStyleDescription object associated with the style specified by AObject, if such a description is set.
You can set the style description fields using the Tools > Bitmap Style Designer dialog

hug

Share this post


Link to post

Thanks again.  I had a look at the Bitmap Style Designer and can see that I can use it to make adjustments to the style I have chosen.  There are some button borders that are too bright so I should be able to adjust them here.

My original problem remains.  One of the objects in the style causes an AV on closedown if FullDebugMode is on using FastMM4 4.992, not the version shipped with Delphi.  Looking at the object in the Designer doesn't give me any clues as to what is going wrong.  The issue happens with other premium styles.  Standard styles are OK.

 

I can get around the issue by using a modified style with the problem object removed, when testing and debugging, and using the full style for release.  I did not have any problems with the style in 10.3.  It is only since upgrading to 10.4, so something has changed in FMX.  I will probably lodge a bug report, but doubt anything will happen in the short term, if at all, as it occurs when you don't use the built in FastMM.

 

I have learnt a lot about styles, which is something I wanted to do, and feel I have a much better understanding of how it all works now.

 

Thanks again for your guidance. 

Share this post


Link to post
Guest

not for that!

did you tryed on FMM 5 for example to replicate this problem?

NOTE: I dont use any FMM version, just IDE 10.3.3 stock!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×