Important: The information in this document is obsolete and should not be used for new development.
CMCloseProfile
Decrements the reference count for the specified profile reference and, if the reference count reaches 0, frees all private memory and other resources associated with the profile.
pascal CMError CMCloseProfile (CMProfileRef prof);
prof
- A profile reference (page 3-63) to the profile that may need to be closed.
- function result
- A result code of type CMError. See "Result Codes" (page 3-174) for a list of ColorSync-specific result codes.
DISCUSSION
The ColorSync Manager keeps an internal reference count for each profile reference returned from a call to theCMOpenProfile
,CMNewProfile
,CMCopyProfile
, orCWNewLinkProfile
functions. Calling the CMCloneProfileRef function (page 3-78) increments the count; calling theCMCloseProfile
function decrements it. The profile remains open as long as the reference count is greater than 0, indicating there is at least one remaining reference to the profile. When the count reaches 0, the ColorSync Manager releases all private memory, files, or resources allocated in association with that profile.When the ColorSync Manager releases all private memory and resources associated with a profile, any temporary changes your application made to the profile are not saved unless you first call the
CMUpdateProfile
function to update the profile.When your application passes a copy of a profile reference to an independent task, whether synchronous or asynchronous, it should call CMCloneProfileRef (page 3-78) to increment the reference count. Both the called task and the caller should call
CMCloseProfile
when finished with the profile reference.
When your application passes a copy of a profile reference internally, it may not need to call CMCloneProfileRef, as long as the application calls
- Note
- You call CMCloneProfileRef after copying a profile reference, but not after duplicating an entire profile (as with the CMCopyProfile function).
CMCloseProfile
once for the profile.
If you create a new profile by calling the
- IMPORTANT
- In your application, make sure that
CMCloseProfile
is called once for each time a profile reference is created or cloned. Otherwise, the private memory and resources associated with the profile reference may not be properly freed, or an application may attempt to use a profile reference that is no longer valid.CMNewProfile
function, the profile is saved to disk when you call theCMCloseProfile
function unless you specifiedNULL
as the profile location when you created the profile.SEE ALSO
To save changes to a profile before closing it, use theCMUpdateProfile
function (page 3-73).