After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 621021 - Crashes when using Soup
Crashes when using Soup
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: API
unspecified
Other Linux
: Normal critical
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2010-06-08 20:34 UTC by Gustavo Noronha (kov)
Modified: 2010-06-09 13:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test case (552 bytes, text/plain)
2010-06-08 20:34 UTC, Gustavo Noronha (kov)
Details

Description Gustavo Noronha (kov) 2010-06-08 20:34:51 UTC
Created attachment 163100 [details]
test case

I believe there might be a problem with memory management somewhere. I am using gobject introspection 0.6.14, and libsoup 2.30.1 from Debian. The program I am attaching crashes some times, when quitting. I am actually trying to figure out a crash I'm getting in a more complex application, I believe this might be related.

Any ideas on how to get useful debugging information for this are welcomed!
Comment 1 johnp 2010-06-08 20:48:49 UTC
This usually has to do with incorrect transfer annotations on the API you are using.  I'm guessing message.get_uri() isn't marked as (transfer none) and the results are being freed.  You can debug this by running the app in gdb as such:

gdb --args python test.py

When the crash occurs you can go up the stack and find which object is causing the crash.


Another this is there is known issues with importing gtk and pygi in the same program.  Try from gi.repository import Gtk instead (same for GObject).  Also, pygobject needs to be compiled with the --enable-pygi switch.
Comment 2 johnp 2010-06-08 22:06:51 UTC
Looking at git soup_message_get_uri is indeed annotated incorrectly:

/**
 * soup_message_get_uri:
 * @msg: a #SoupMessage
 *
 * Gets @msg's URI
 *
 * Return value: the URI @msg is targeted for.
 **/
SoupURI *
soup_message_get_uri (SoupMessage *msg)
{
	g_return_val_if_fail (SOUP_IS_MESSAGE (msg), NULL);

	return SOUP_MESSAGE_GET_PRIVATE (msg)->uri;
}


If you notice we are simply returning an internal uri without reffing it.  In this case the return value needs to be annotated as transfer none in the doc string:

* Return value: (transfer none): the URI @msg is targeted for.

There might be other API that needs the same treatment.  Moving this to libsoup for now.  If all the annotations are fixed and you still have an issue please feel free to switch this back to pygi.
Comment 3 Dan Winship 2010-06-09 13:39:33 UTC
fixed soup_message_get_uri() and a handful of other getters in git.

(that's assuming you're using introspection from libsoup itself; I
haven't kept the annotations in gir-repository up-to-date...)

I think the guy who did most of the introspection work for libsoup was
mostly using the server-side API, so you may find other places where
the client-side API is missing annotations, etc.