Commit 1efbf524 authored by Zeeshan Ali's avatar Zeeshan Ali

web,3g: Don't access instance pointer after finalize

Apparently soup_session_cancel_message is not synchronous so we better
not access the instance pointer in message callback if it was cancelled.
parent fe2aa609
......@@ -69,6 +69,7 @@ cancel_pending_query (GClue3G *source)
soup_session_cancel_message (priv->soup_session,
priv->query,
SOUP_STATUS_CANCELLED);
priv->query = NULL;
}
if (priv->network_changed_id != 0) {
......@@ -243,11 +244,15 @@ query_callback (SoupSession *session,
SoupMessage *query,
gpointer user_data)
{
GClue3G *source = GCLUE_3G (user_data);
GClue3G *source;
char *contents;
GeocodeLocation *location;
SoupURI *uri;
if (query->status_code == SOUP_STATUS_CANCELLED)
return;
source = GCLUE_3G (user_data);
source->priv->query = NULL;
if (query->status_code != SOUP_STATUS_OK) {
......
......@@ -53,12 +53,16 @@ query_callback (SoupSession *session,
SoupMessage *query,
gpointer user_data)
{
GClueWebSource *web = GCLUE_WEB_SOURCE (user_data);
GClueWebSource *web;
GError *error = NULL;
char *contents;
GeocodeLocation *location;
SoupURI *uri;
if (query->status_code == SOUP_STATUS_CANCELLED)
return;
web = GCLUE_WEB_SOURCE (user_data);
web->priv->query = NULL;
if (query->status_code != SOUP_STATUS_OK) {
......@@ -133,6 +137,7 @@ gclue_web_source_finalize (GObject *gsource)
soup_session_cancel_message (priv->soup_session,
priv->query,
SOUP_STATUS_CANCELLED);
priv->query = NULL;
}
g_clear_object (&priv->soup_session);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment