Re: [gmime-devel] GObject unref hell



On 06/11/13 14:48, Jeffrey Stedfast wrote:
On 11/6/2013 8:25 AM, Mario Theodoridis wrote:
On 06/11/13 13:31, Jeffrey Stedfast wrote:
On 11/6/2013 4:21 AM, Mario Theodoridis wrote:
 ...
int mimeFromRgsMsg(msgObj msg, rgsMsg rgMsg) {
[snip]

        if (attCnt == 0) {
            /* remove unneeded multi part */
            g_mime_message_set_mime_part (msg->message, (GMimeObject*)
part);
            msg->headerList =
g_mime_object_get_header_list((GMimeObject*)part);
            rfunref (part);
            break;
        }

        /* there are many parts */
        multipart = g_mime_multipart_new_with_subtype ("mixed");

Here i create the new multipart.

        g_mime_multipart_add (multipart, (GMimeObject *) part);
        rfunref (part);
        part = NULL; [snip]

        g_mime_message_set_mime_part (msg->message, (GMimeObject*)
multipart);

Here i replace whatever was in the message which i'm not referencing anywhere. This is where i think the error happens.

        msg->headerList =
g_mime_object_get_header_list((GMimeObject*)multipart);
        rfunref (multipart);

I unref my created multipart because i'm done with it. This does not cause an error.


    } while(FALSE);

I would guess that the problem is because you remove the multipart (by
setting some other part) on the message object, which unrefs the
multipart, and then you set the unref'd multipart back on the message
and then unref it again.

The multipart i add is a new one.
Is that not how i should do this?

--
Mit Freundlichen Grüßen / Regards

Mario Theodoridis

regify®
your mail matters


regify S.A. | 2b, Ennert dem Bierg | L-5244 Sandweiler / Luxembourg

phone: +352 268 9321 | internet: www.regify.com
executive board: Kurt Kammerer, Volker Schmid
supervisory board chairman: Dr. Hans-Peter Kohlhammer
commercial register: Registre de Commerce et des Sociétés B 156705


regify GmbH | Römerstrasse 39 | D-78183 Hüfingen / Germany

Telefon: +49 771 8978 4238 | Internet: www.regify.com
Geschäftsführung: Kurt Kammerer, Volker Schmid
Handelsregister: Amtsgericht Freiburg HRB 709343


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]