diff options
| -rw-r--r-- | doc/gpgme.texi | 11 | ||||
| -rw-r--r-- | src/gpgme.c | 12 | 
2 files changed, 14 insertions, 9 deletions
| diff --git a/doc/gpgme.texi b/doc/gpgme.texi index bce6aefd..010b914d 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -2690,8 +2690,6 @@ a status message callback function.  The argument @var{keyword} is the name of the status message while the  @var{args} argument contains any arguments for the status message. -The status message may have come from gpg or libgpgme. -  If an error occurs, return the corresponding @code{gpgme_error_t}  value. Otherwise, return @code{0}.  @end deftp @@ -2699,9 +2697,9 @@ value. Otherwise, return @code{0}.  @deftypefun void gpgme_set_status_cb (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_status_cb_t @var{statusfunc}}, @w{void *@var{hook_value}})  The function @code{gpgme_set_status_cb} sets the function that is used when a  status message is received from gpg to @var{statusfunc}. The function -@var{statusfunc} needs to implemented by the user, and whenever it is called, -it is called with its first argument being @var{hook_value}.  By default, no -status message callback function is set. +@var{statusfunc} needs to be implemented by the user, and whenever it is +called, it is called with its first argument being @var{hook_value}.  By +default, no status message callback function is set.  The user can disable the use of a status message callback function by calling  @code{gpgme_set_status_cb} with @var{statusfunc} being @code{NULL}. @@ -2713,9 +2711,6 @@ process status messages from gpg in @var{*statusfunc}, and the first argument  for this function in @var{*hook_value}.  If no status message callback is set,  or @var{ctx} is not a valid pointer, @code{NULL} is returned in both  variables. - -@var{statusfunc} or @var{hook_value} can be @code{NULL}.  In this case, -the corresponding value will not be returned.  @end deftypefun diff --git a/src/gpgme.c b/src/gpgme.c index 9c09827e..0cf999a7 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -679,7 +679,17 @@ gpgme_get_status_cb (gpgme_ctx_t ctx, gpgme_status_cb_t *r_cb,  		       void **r_cb_value)  {    TRACE2 (DEBUG_CTX, "gpgme_get_status_cb", ctx, "ctx->status_cb=%p/%p", -	  ctx->status_cb, ctx->status_cb_value); +	  ctx ? ctx->status_cb : NULL, ctx ? ctx->status_cb_value : NULL); + +  if (r_cb) +    *r_cb = NULL; + +  if (r_cb_value) +    *r_cb_value = NULL; + +  if (!ctx || !ctx->status_cb) +    return; +    if (r_cb)      *r_cb = ctx->status_cb;    if (r_cb_value) | 
