Browse Source

* Fix bug ID #24099 (make sure self is not destroyed while disconnecting sink)

git-svn-id: trunk@36771 -
michael 8 years ago
parent
commit
aa5b2ff6fb
1 changed files with 2 additions and 0 deletions
  1. 2 0
      packages/winunits-base/src/eventsink.pp

+ 2 - 0
packages/winunits-base/src/eventsink.pp

@@ -169,9 +169,11 @@ procedure TAbstractEventSink.Disconnect;
 begin
 begin
  if Assigned(FDispatch) then begin
  if Assigned(FDispatch) then begin
   // Unhook the sink from the automation server
   // Unhook the sink from the automation server
+  Self._addRef;
   InterfaceDisconnect(FDispatch, FDispIntfIID, FConnection);
   InterfaceDisconnect(FDispatch, FDispIntfIID, FConnection);
   FDispatch := nil;
   FDispatch := nil;
   FConnection := 0;
   FConnection := 0;
+  self._Release;
  end;
  end;
 end;
 end;