Przeglądaj źródła

Interface unref should zero the pointer first.

Rika Ichinose 6 miesięcy temu
rodzic
commit
1e041077cc
1 zmienionych plików z 5 dodań i 2 usunięć
  1. 5 2
      rtl/inc/objpas.inc

+ 5 - 2
rtl/inc/objpas.inc

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