Next: , Previous: , Up: Contexts   [Contents][Index]

7.3 Result Management

The detailed result of an operation is returned in operation-specific structures such as gpgme_decrypt_result_t. The corresponding retrieval functions such as gpgme_op_decrypt_result provide static access to the results after an operation completes. Those structures shall be considered read-only and an application must not allocate such a structure on its own. The following interfaces make it possible to detach a result structure from its associated context and give it a lifetime beyond that of the current operation or context.

Function: void gpgme_result_ref (void *result)

SINCE: 1.2.0

The function gpgme_result_ref acquires an additional reference for the result result, which may be of any type gpgme_*_result_t. As long as the user holds a reference, the result structure is guaranteed to be valid and unmodified.

Function: void gpgme_result_unref (void *result)

SINCE: 1.2.0

The function gpgme_result_unref releases a reference for the result result. If this was the last reference, the result structure will be destroyed and all resources associated to it will be released.

Note that a context may hold its own references to result structures, typically until the context is destroyed or the next operation is started. In fact, these references are accessed through the gpgme_op_*_result functions.