浏览代码

Interface unref should zero the pointer first.

Rika Ichinose 6 月之前
父节点
当前提交
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;