Hello, if FPC interfaces are working the same that Delphi interfaces do, then you should NEVER call ._Release() explicitly This is (calling _Release()) done my the compiler implicitly: * if variable is no longer available (exiting the function local variable interfaces are released) * if variable value is changed (assigned another interface or nil). if interface variable is nil, it will not be released by compiler (check is done in runtime).
cleanD3D() causes interfaces to be released twice, because compiler will release interfaces on program finalization. the proper code for cleanD3D is: procedure cleanD3D(); begin d3ddev:=nil; // close and release the 3D device // _Release is called here by fpc d3d:=nil; // close and release Direct3D // _Release is called here by fpc end; Thanks, Dmitry _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal