소스 검색

Interface unref should zero the pointer first.

Rika Ichinose 7 달 전
부모
커밋
1e041077cc
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      rtl/inc/objpas.inc

+ 5 - 2
rtl/inc/objpas.inc

@@ -53,11 +53,14 @@
 
     { interface helpers }
     procedure fpc_intf_decr_ref(var i: pointer);[public,alias: 'FPC_INTF_DECR_REF']; compilerproc;
+      var
+        iFetch: pointer;
       begin
-        if assigned(i) then
+        iFetch:=i;
+        if assigned(iFetch) then
           begin
-            IUnknown(i)._Release;
             i:=nil;
+            IUnknown(iFetch)._Release;
           end;
       end;