Jump to content
Sign in to follow this  
wqmeng

FMX app hanging at start after windows 11 run for a long time(a few hours).

Recommended Posts

FMX app hanging at start after Windows 11 run for a long time(a few hours).

 

Anybody here notice that when the Windows 11 runs for a while such as a few hours, And my FMX app will be hanging at startup, but I tried to start other apps, there is no such problem. I tested use delphi to create a empty form FMX app, it is still hang when startup, but VCL app will run fine.  In this case, the Delphi IDE also has many problems, such the form design window will not load the fmx form and show it, the Object explore and the properties of the form element also do not shows anything,  And the popup menu of Delphi IDE will not show the mouse highlight background, and some dialog form of Delphi IDE will not accept mouse click, but if you move keyboard to the buttons on the form, it may(or not) works.  I try to open the tools option and User interface and form designer, High DPI, the listbox do not show any listitems in it, and the checkbox show white blank, can not see any words in the text area.  And the checkbox  could not click/ select or deselect by mouse click.

 

And there seems more problem. But the mostly problem is the FMX app can not run at start up, If I try to start the FMX app repeated by shutdown it in the task manager, After a few retries such as 5 - 20 times, it may startup without any change of the OS. 

 

When the problem happens, My Memory shows about 45% (48G total) use, and CPU about 50%( I5 13400F )  usage.  

 

Other strange problem the Firefox browser can not copy any text in the web page, and  the popup menu of taskbar could not response to mouse too, but you can move up/down button of keyboard to select the popupmenu item and click it to call the command.

 

I am not very sure what's cause this, the probem effect the FMX apps and Delphi IDE,  but seems not effect VCL apps.

 

It is worse that the problem happens every day on my PC.

 

Anybody with advice or have a solution?


Thank you.

Share this post


Link to post

No solution but some thoughts. FMX forms use GPU resources including when designing in the IDE which is not the case for most VCL forms/components.

 

Perhaps re-install / upgrade to the latest graphics drivers with whatever 'clean install' option is available selected in the installer.

Share this post


Link to post

Hello,

 

Thank you all for your replies, Now I check the output in the IDE with a FMX form with a few buttons on it, and find out if the app hangs up, it will stop at

Module Load: d2d1.dll. No Debug Info. Base Address: $78970000. Process TestWin11HangUp.exe (40248)
Module Load: DWrite.dll. No Debug Info. Base Address: $5B760000. Process TestWin11HangUp.exe (40248)
Debug Output: Cannot get DirectX SharedMultithread object. Process TestWin11HangUp.exe (40248)
Debug Output: Cannot get DirectX SharedMultithread object. Process TestWin11HangUp.exe (40248)
Debug Output: Cannot get DirectX SharedMultithread object. Process TestWin11HangUp.exe (40248)
Debug Output: Cannot get DirectX SharedMultithread object. Process TestWin11HangUp.exe (40248)
Thread Exit: Thread ID: 81372. Process TestWin11HangUp.exe (40248)
 

If the App start correctly,

Module Load: d2d1.dll. No Debug Info. Base Address: $78970000. Process TestWin11HangUp.exe (42448)
Module Load: DWrite.dll. No Debug Info. Base Address: $5B760000. Process TestWin11HangUp.exe (42448)
Debug Output: Cannot get DirectX SharedMultithread object. Process TestWin11HangUp.exe (42448)
Debug Output: Cannot get DirectX SharedMultithread object. Process TestWin11HangUp.exe (42448)
Module Load: igdumdim32.dll. No Debug Info. Base Address: $78E90000. Process TestWin11HangUp.exe (42448)
Module Load: igd9trinity32.dll. No Debug Info. Base Address: $79150000. Process TestWin11HangUp.exe (42448)
Module Load: igd9dxva32.dll. No Debug Info. Base Address: $7A840000. Process TestWin11HangUp.exe (42448)
 

 

The different is that the failed app try to get DirectX SharedMultithread object 4 times and without success?  Finally, the app form do not shows up correctly.

Debug Output: Cannot get DirectX SharedMultithread object. Process TestWin11HangUp.exe (40248)
 

Try to find more information about 'Cannot get DirectX SharedMultithread object', cound not find any useful results.

 

Thank you.

Share this post


Link to post

After seach, Find this 'Cannot get DirectX SharedMultithread object.' is defined in FMX.Canvas.D2D,

 

const
  SID_ID2D1Multithread = '{31e6e7bc-e0ff-4d46-8c64-a0a8c41c15d3}';
  IID_ID2D1Multithread: TGUID = SID_ID2D1Multithread;
  SCannotGetSharedMultithreadObject = 'Cannot get DirectX SharedMultithread object.';

 

The only codes not Succeeded(SharedFactory.QueryInterface(IID_ID2D1Multithread, FSharedMultithread)).

Try to query an interface, and failled?

class procedure TCanvasD2D.CreateSharedResources;
var
  Prop: TD2D1RenderTargetProperties;
  Desc: TD3D10_Texture2DDesc;
begin
  inherited;
  if (FSharedMultithread = nil) and not Succeeded(SharedFactory.QueryInterface(IID_ID2D1Multithread, FSharedMultithread)) then
    FSharedMultithread := nil;

  MultithreadEnter;
  try
    if FSharedRenderTarget = nil then
    begin
      FillChar(Desc, SizeOf(D3D10_TEXTURE2D_DESC), 0);
      Desc.Format := DXGI_FORMAT_B8G8R8A8_UNORM;
      Desc.Width := 1;
      Desc.Height := 1;
      Desc.MipLevels := 1;
      Desc.ArraySize := 1;
      Desc.SampleDesc.Count := 1;
      Desc.SampleDesc.Quality := 0;
      Desc.Usage := D3D10_USAGE_DEFAULT;
      Desc.BindFlags := D3D10_BIND_RENDER_TARGET or D3D10_BIND_SHADER_RESOURCE;

      if Failed(SharedDevice.CreateTexture2D(Desc, nil, FSharedTexture)) then
        raise ECannotCreateTexture.CreateFmt(SCannotCreateTexture, [ClassName]);

      Prop := D2D1RenderTargetProperties(DefaultRenderTargetMode, D2D1PixelFormat(DXGI_FORMAT_UNKNOWN,
        D2D1_ALPHA_MODE_PREMULTIPLIED));

      if Failed(SharedFactory.CreateDxgiSurfaceRenderTarget(FSharedTexture as IDXGISurface, Prop,
        FSharedRenderTarget)) then
        raise ECannotCreateRenderTarget.CreateFmt(SCannotCreateRenderTarget, [ClassName]);
    end;
  finally
    MultithreadLeave;
  end;
end;

 

Share this post


Link to post

This codes, When FSharedMultithread is nil, it will not lock the thread, so that may cause a conflict?  Then the app is hangs out?  But why the QueryInterface is fail still not known the reason, an OS problem?

Share this post


Link to post

Any Antivirus software Installed? That feels more than an external Problem than a Internal one.

Share this post


Link to post

There is no other antivirus installed.  This problem will disappear after the windows11 restart, but it will happen again once the OS run a few hours.

Share this post


Link to post

Instead of rebooting try Win+Ctrl+Shift+B shortcut to reset/restart the graphics driver. Not a solution but might point to what is causing problems.

Edited by Brian Evans

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
Sign in to follow this  

×