   DXUT: Strange error using GUI helper classes
  Hi all!As you all know, in the files DXUTgui.cpp/h there are some premade classes for GUI handling. I'm having a wierd problem when I use the CDXUTDialogResourceManager or the CDXUTDialog classes. If I create an instance of the CDXUTDialogResourceManager I get a error message when my application exits (after the call to DXUTCleanup3DEnvironment()). The error messages states that:"hr=DXUTERR_NONZEROREFCOUNT ()0x80040904D3DX: MEMORY_LEAKS_DETECTED: 2 allocations unfreed (448 bytes)D3DX: Set HKLM\Software\Microsoft\Direct3D\D3DXBreakOnAllocId=0x46af to debug".Note that I have deleted the CDXUTDialogResourceManager instance before my application exits, i.e SAFE_DELETE(m_dialogResMgr) and before the call to DXUTCleanup3DEnvironment(). I've checked my application and the problem only appears when create an instance of the CDXUTDialogResourceManager (either dynamic or static). If I don't create the instance, the memory problem does not appear. The problem also appears if I continue to also create an instance of the CDXUTDialog class. However, the number of unfreed allocations increase. I've looked at the UISample in the SDK and I can't figure out how to fix the problem. As I understand it, somewhere in the CDXUTDialogResourceManager or CDXUTDialog either something is not freed properly or something is AddRef():ed and not Release():ed. But then again, I may be totaly wrong. It wouldn't be the first time :)So, has anyone had this problem?  Best Regards,Risto   
  It is not releasing one of the COM resources.  Take a look at the destructors for the different GUI classes.  I think it uses sprites for some things.  Are you sure you are deleting things in the correct order?   ;  Hi!DXnut You were right. I looked over my code and sure enough, I had missed two calls (OnLostDevice() and OnDestroyDevice()). Once I added these calls to my code, everything works perfectly and all objects are released as they should.Thx for Your help DXnut!BR,Risto   