[gupnp/wip/phako/new-api: 10/17] wip: Fix crash on action return
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp/wip/phako/new-api: 10/17] wip: Fix crash on action return
- Date: Sun, 13 Jan 2019 18:14:03 +0000 (UTC)
commit 844748de212619892c4a00b7528f0e8567848b42
Author: Jens Georg <mail jensge org>
Date: Sun Jan 13 16:39:08 2019 +0100
wip: Fix crash on action return
libgupnp/gupnp-service-proxy.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index 4e03774..2541768 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -553,7 +553,8 @@ on_legacy_async_callback (GObject *source, GAsyncResult *res, gpointer user_data
gupnp_service_proxy_call_action_finish (GUPNP_SERVICE_PROXY (source), res, &error);
action = (GUPnPServiceProxyAction *) user_data;
- action->callback (action->proxy, action, action->user_data);
+ if (action->callback != NULL)
+ action->callback (action->proxy, action, action->user_data);
}
/**
@@ -610,9 +611,7 @@ gupnp_service_proxy_begin_action (GUPnPServiceProxy *proxy,
/* Begins a basic action message */
static void
prepare_action_msg (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *ret,
- GUPnPServiceProxyActionCallback callback,
- gpointer user_data)
+ GUPnPServiceProxyAction *ret)
{
GUPnPServiceProxyPrivate *priv;
char *control_url, *full_action;
@@ -623,9 +622,6 @@ prepare_action_msg (GUPnPServiceProxy *proxy,
ret->proxy = proxy;
g_object_add_weak_pointer (G_OBJECT (proxy), (gpointer *)&(ret->proxy));
- ret->callback = callback;
- ret->user_data = user_data;
-
priv->pending_actions = g_list_prepend (priv->pending_actions, ret);
/* Make sure we have a service type */
@@ -2232,7 +2228,7 @@ gupnp_service_proxy_call_action_async (GUPnPServiceProxy *proxy,
gupnp_service_proxy_action_ref (action),
(GDestroyNotify) gupnp_service_proxy_action_unref);
- prepare_action_msg (proxy, action, NULL, NULL);
+ prepare_action_msg (proxy, action);
if (action->error != NULL) {
g_task_return_error (task, g_error_copy (action->error));
@@ -2270,7 +2266,7 @@ gupnp_service_proxy_call_action (GUPnPServiceProxy *proxy,
g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), NULL);
- prepare_action_msg (proxy, action, NULL, NULL);
+ prepare_action_msg (proxy, action);
if (action->error != NULL) {
g_propagate_error (error, g_error_copy (action->error));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]