// Case 1) User created structure: // allocate native on creation, free native on dispose. internal CfrStructure(CtorRemoteCall ctor, DtorRemoteCall dtor) { this.dtor = dtor; ctor.RequestExecution(); SetRemotePtr(new RemotePtr(ctor.__retval)); RemotePtr.connection.weakCache.Add(RemotePtr.ptr, this); }
// Case 1) User created structure: // allocate native on creation, free native on dispose. internal CfrStructure(CtorRemoteCall ctor, DtorRemoteCall dtor) { this.dtor = dtor; ctor.RequestExecution(); SetRemotePtr(new RemotePtr(CfxRemoteCallContext.CurrentContext.connection, ctor.__retval)); lock (RemotePtr.connection.weakCache) { // TODO: where to remove this from the cache? RemotePtr.connection.weakCache.Add(RemotePtr.ptr, this); } }