anchor.diff:    //The actual WeakReference implementation.
     TWeakReference<T: IInterface> = class(TInterfacedObject, IWeakReference<T>)
     private
  -    FData : TObject;
  +    FData : Pointer;
     protected
       function IsAlive : boolean;
       function Data : T;
  
positive.code:     Result := E_NOINTERFACE;
  end;
  
  
  function TWeakReferencedObject._AddRef: Integer;
  begin
    Result := InterlockedIncrement(FRefCount);
  end;
  
  function TWeakReferencedObject._Release: Integer;
  begin
    Result := InterlockedDecrement(FRefCount);
    if Result = 0  then
      Destroy;
  end;
  
  
  end.
  
negative.code: { TWeakReferencedObject }
  
  procedure TWeakReferencedObject.AddWeakRef(value: Pointer);
  begin
    MonitorEnter(Self);
    try
      if FWeakReferences = nil then
        FWeakReferences := TList<Pointer>.Create;
      FWeakReferences.Add(value);
    finally
      MonitorExit(Self);
    end;
  end;
  
  procedure TWeakReferencedObject.RemoveWeakRef(value: Pointer);
  begin
    MonitorEnter(Self);
    try
      if FWeakReferences = nil then // should never happen
        {$IFDEF DEBUG}
        raise Exception.Create('FWeakReferences = nil');
        {$ELSE}
        exit;
        {$ENDIF}
      FWeakReferences.Remove(value);
      if FWeakReferences.Count = 0 then
        FreeAndNil(FWeakReferences);
    finally
      MonitorExit(Self);
    end;
  end;
  
  procedure TWeakReferencedObject.AfterConstruction;
  begin
  {$IFNDEF AUTOREFCOUNT}
    TInterlocked.Decrement(FRefCount);
  {$ENDIF}
  end;
  
  procedure TWeakReferencedObject.BeforeDestruction;
  var
    value : PPointer;
    i: Integer;
  begin
  {$IFNDEF AUTOREFCOUNT}
    if RefCount <> 0 then
      System.Error(reInvalidPtr);
  {$ELSE}
    inherited BeforeDestruction;
  {$ENDIF}
    MonitorEnter(Self);
    try
      if FWeakReferences <> nil then
      begin
        for i := 0 to FWeakReferences.Count -1 do
        begin
          value := FWeakReferences.Items[i];
          value^ := nil;
        end;
        FreeAndNil(FWeakReferences);
      end;
    finally
      MonitorExit(Self);
    end;
  end;
  
  function TWeakReferencedObject.GetRefCount: integer;
  begin
    Result := FRefCount and not objDestroyingFlag;
  end;
  
  class function TWeakReferencedObject.NewInstance: TObject;
  begin
    Result := inherited NewInstance;
  {$IFNDEF AUTOREFCOUNT}
    // Set an implicit refcount so that refcounting
    // during construction won't destroy the object.
    TWeakReferencedObject(Result).FRefCount := 1;
  {$ENDIF}
  end;
  
  function TWeakReferencedObject.QueryInterface(const IID: TGUID; out Obj): HResult;
  