> -----Original Message----- > From: Phil Thompson [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 24, 2005 3:45 AM > To: [email protected] >.......... > In your implementation of reverse() you are freeing the memory allocated > to > the Word structure and the word itself. Because the wrapper has ownership > it > will also try to free the memory which will result in the seg fault. > > Either remove the calls to free() or add /Transfer/ to the argument to > reverse(). > > Phil
Thank you Phil for the reply. I did try as you suggested by removing the 2
free() calls in the reverse() or just simply implement reverse() by
return word->the_word;
I also tried adding the /Transfer/ annotation to the argument of reverse()
in the word.sip file without removing the 2 free() calls. I still get the
segmentation fault.
BTW, here is one of the generated functions in sipwordWord.c that I guess is
used by the wrapper to free the memory:
static void dealloc_Word(sipWrapper *sipSelf)
{
If(sipIsPyOwned(sipSelf))
sipFree(sipSelf -> u.cppPtr);
}
I am not sure if the above function is able to free "the_word" member in the
"Word" structure, so I tried keeping "free(word->the_word);" in the
reverse() too, it doesn't help either. For the whole generated C files,
please see the attachment.
Huaicai
sipwordWord.c
Description: Binary data
sipwordcmodule.c
Description: Binary data
_______________________________________________ PyKDE mailing list [email protected] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
