[fpc-pascal] DirectX applications crash
dmitry boyarintsev
skalogryz.lists at gmail.com
Tue Mar 17 06:51:36 CET 2009
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
More information about the fpc-pascal
mailing list