2
0
Эх сурвалжийг харах

Interface unref should zero the pointer first.

Rika Ichinose 6 сар өмнө
parent
commit
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;