Hello,

I'am writing a plugin for lxpanel (version 0.5.12).
In that plugin I want to query an webserver with libsoup.

In the constructor I added this line:
   g_timeout_add_seconds(60, &query_uri, NULL);

This my query_uri function:

static SoupSession *session;
static GMainLoop *loop;

gboolean query_uri()
{
     const char *url;
     SoupURI *proxy_uri, *parsed;
     GError *error = NULL;
     SoupLogger *logger = NULL;

     url = "http://localhost/test.php";;
     parsed = soup_uri_new (url);
     if (!parsed) {
         g_printerr ("Could not parse '%s' as a URL\n", url);
         exit (1);
     }
     soup_uri_free (parsed);

     session = soup_session_new();
     loop = g_main_loop_new(NULL, True);

     get_url(url);

     g_main_loop_unref(loop);
     return True;
}

The get_url function is from the libsoup example:
https://github.com/GNOME/libsoup/blob/master/examples/get.c


If I run the plugin I get an segmentation fault.

Output of gdb is:
Program received signal SIGSEGV, Segmentation fault.
0xb7ff0000 in _dl_find_dso_for_object () from /lib/ld-linux.so.2
(gdb) bt
#0  0xb7ff0000 in _dl_find_dso_for_object () from /lib/ld-linux.so.2
#1  0x081c8be8 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

The problematic call seems to be the call to soup_session_queue_message.
Maybe this code runs only in an gtk_main loop? If I add an gtk_main() to 
the constructor of the plugin, the libsoup code gets executed without 
error!


How can I run this code in an lxpanel plugin? Any ideas or hints?



------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Lxde-list mailing list
Lxde-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxde-list

Reply via email to