NS_IF_RELEASE

This page still needs some work, help to improve it!

Summary

Macro

Decrements the reference count of a pointer by one. This macro also sets the pointer to NULL. NS_IF_RELEASE has no effect when the pointer is NULL. This macro should only be used when the pointer might be NULL; otherwise, use NS_RELEASE.

NS_IF_RELEASE is exactly equivalent to the following function:

inline void NS_IF_RELEASE(nsISupports* foo)
{
  if (foo)
    foo->Release();
  foo = 0;
}

Syntax

NS_IF_RELEASE(foo);

See Also

NS_ADDREF, NS_RELEASE

Document Tags and Contributors

 Contributors to this page: teoli, Waldo, Ehsan, Editmonkey, cbiesinger
 Last updated by: Waldo,