nsIWeakReference
From MDC
Contents |
[edit] Summary
The nsIWeakReference interface represents a proxy for an XPCOM object. It allows a consumer to hold an indirect, non-owning reference to an XPCOM object.
See Weak reference for a more detailed description.
#include "nsIWeakReference.h"
[scriptable, uuid=(9188bc85-f92e-11d2-81ef-0060083a0bcf)]
interface nsIWeakReference : nsISupports { ... };
[edit] Methods
QueryReferent- The
QueryReferentmethod queries an interface on the referent if it exists, and likensISupports::QueryInterface, produces an owning reference to the desired interface.
[edit] Remarks
An instance of nsIWeakReference is a proxy object that cooperates with its referent to give clients a non-owning, non-dangling reference. Clients own the nsIWeakReference instance. The QueryReferent method provides a (hopefully short-lived) owning reference on demand, through which clients can get useful access to the referent, while it still exists.
QueryReferent may fail if the referent no longer exists.
[edit] History
This interface was frozen for Mozilla 0.9.9. See bug 48726 for details.
[edit] See also
QueryReferent,
nsISupports::QueryInterface,
nsISupportsWeakReference