/pidgin/main: 9605c0a2839e: Don't crash when cancelling non-exis...

Tomasz Wasilczyk tomasz at wasilczyk.pl
Mon Oct 22 06:18:18 EDT 2012


This function can be used, for example, for cleaning up when unloading a
plugin. I was sure, that we could want to use it in the same way as g_free
- just call it with a handle and free if it's needed.

Just like in the g_free case (and with the previous http implementation),
after calling purple_http_conn_cancel, data is free'd.
22-10-2012 08:24, "Mark Doliner" <mark at kingant.net> napisał(a):

> On Sun, Oct 21, 2012 at 4:27 PM, Tomasz Wasilczyk
> <tomkiewicz at cpw.pidgin.im> wrote:
> > Changeset: 9605c0a2839e45db17956dce504a31c6170a94e5
> > Author:  Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
> > Date:    2012-10-22 01:27 +0200
> > Branch:  default
> > URL: http://hg.pidgin.im/pidgin/main/rev/9605c0a2839e
> >
> > Description:
> >
> > Don't crash when cancelling non-existent HTTP connection
> >
> > diffstat:
> >
> >  libpurple/http.c |  3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> >
> > diffs (13 lines):
> >
> > diff --git a/libpurple/http.c b/libpurple/http.c
> > --- a/libpurple/http.c
> > +++ b/libpurple/http.c
> >  void purple_http_conn_cancel(PurpleHttpConnection *http_conn)
> >  {
> > +       if (http_conn == NULL)
> > +               return;
> > +
>
> Hey Tomasz, is there a legitimate reason to call this function with
> null?  I feel like it might be cleaner to use
> g_return_if_fail(http_conn != NULL), but I also don't have a strong
> opinion.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.im/pipermail/devel/attachments/20121022/6b7d4f13/attachment-0002.html>


More information about the Devel mailing list