Platform SDK: Transaction Server

getSafeRef Method

[This product will work only on Windows NT 4.0 versions and earlier. For Windows 2000 and later, see COM+ (Component Services).]

Used by an object to obtain a reference to itself that's safe to pass outside its context.

getSafeRef is a static method of the Context class, which is declared in the package com.ms.mtx.

Note The class Context has only static methods and has no public constructor. You can't create an instance of this class.

Provided By

Context class

IUnknown getSafeRef (
    IUnknown unknown
);

Parameter

unknown
[in] A reference to the current object.

Return Value

A reference to the current object that's safe to pass outside the current object's context.

Remarks

When an MTS object wants to pass a self-reference to a client or another object (for example, for use as a callback), it should always call getSafeRef first and then pass the reference returned by this call. An object should never pass a reference to to a client or to any other object. Once such a reference is passed outside the object's context, it's no longer a valid reference.

Calling getSafeRef on a reference that is already safe returns the safe reference unchanged.

See Also

Passing Object References