gpgme -- How should gpgme_release be used?

andres at andres at
Sat May 5 14:55:01 CEST 2001

Thanks, Jose. I confirmed your hypothesis writing a simple C program that
called gpgme_release right after gpgme_new. It worked so the problem was in
my use of SWIG to create the Python bindings. I was malloc'ing memory for a
GpgmeCtx variable when I should just have let gpgme_new do all the work. It
works now.
I would be interested in using your patches if you could send me a copy.  

On Sat, May 05, 2001 at 10:13:38AM +0200, Jose Carlos Garcia Sogo wrote:
> El 04 May 2001 18:03:36 -0400, andres at escribió:
> > Hello,
> > 
> > I'm wrapping gpgme with some Python classes and I have created a "Context"
> > class to shadow the GpgmeCtx data structure.
> > 
> > I can initialize a new context easily with gpgme_new, but when I call
> > gpgme_release immediately on the same context I get this error:
> > 
> > python: key.c:130: gpgme_key_release: Assertion key->ref_count' failed.
>   I'm also using gpgme (not in python but directly in C) and I think
> this should work. You create a new gpgmectx and later you free it...
> this should work.
> BTW: right now I'm working with a slightly modified version of gpgme (I
> have only modified verify.c, encrypt.c and decrypt..c files, so this
> shouldn't affect your problem). I have sent the patch to Werner, but he
> hasn't replied me. I have modifyed these functions because it was not
> possible to call sequentially two or more of these functions using the
> same context. 
> -- 
> José Carlos García Sogo         Seahorse(-bonobo) developer
> jose jaimedelamo eu org

Andres Corrada-Emmanuel   Email: andres at

More information about the Gnupg-devel mailing list