PDA

View Full Version : non-zero reference count! why?



hammer
17-06-2004, 05:58 PM
the error appears right after the
D3DXCreateBox(m_pd3dDevice,1,1,1, thefbox.Themesh,nil);

the class that represents thefbox is:

type

TMyD3DMesh = class
TheMesh : ID3DXMesh;
TheMatrix : TD3DXMatrix;
end;

var thefbox : TMyD3DMesh;

where is the error?
well i cant see it cous when i create a box this way:
D3DXCreateBox(m_pd3dDevice,1,1,1 , fBox,nil);
there is no error but when i try to use the class i get the non-zero reference count :(
why is that?

Clootie
17-06-2004, 06:42 PM
As I've already writen to you - please read basics of MS COM architecture; delphi way of implementing COM (interfaces, smart pointers); what are Delphi "classes" and how to use them.

You should:



begin
thefbox := TMyD3DMesh.Create; // This call allocates class on heap and clears internal class members - in our case interface pointers
D3DXCreateBox(m_pd3dDevice,1,1,1, thefbox.Themesh,nil);
end;

Clootie
17-06-2004, 06:47 PM
have you actually tried to debug your app - seems error message is showing because exception is raized at D3DXCreateBox(...) and error message is generated by destructor of CD3DApplication class... :shock:

hammer
19-06-2004, 03:55 AM
i've found my error ....
and clootie yeah i used .create method
the error was technical.