Skip to content
Snippets Groups Projects
Commit 94b1390d authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

proxy: destroy the pw_proxy in dispose()

Because the proxy_event_destroy() handler now takes a ref to the
WpProxy, which is an error to do in finalize()
parent 375fa8a3
No related branches found
No related tags found
No related merge requests found
...@@ -212,6 +212,18 @@ wp_proxy_constructed (GObject * object) ...@@ -212,6 +212,18 @@ wp_proxy_constructed (GObject * object)
wp_proxy_got_pw_proxy (self); wp_proxy_got_pw_proxy (self);
} }
static void
wp_proxy_dispose (GObject * object)
{
WpProxyPrivate *priv = wp_proxy_get_instance_private (WP_PROXY(object));
/* this will trigger proxy_event_destroy() if the pw_proxy exists */
if (priv->pw_proxy)
pw_proxy_destroy (priv->pw_proxy);
G_OBJECT_CLASS (wp_proxy_parent_class)->dispose (object);
}
static void static void
wp_proxy_finalize (GObject * object) wp_proxy_finalize (GObject * object)
{ {
...@@ -220,7 +232,6 @@ wp_proxy_finalize (GObject * object) ...@@ -220,7 +232,6 @@ wp_proxy_finalize (GObject * object)
g_debug ("%s:%p destroyed (global %u; pw_proxy %p)", g_debug ("%s:%p destroyed (global %u; pw_proxy %p)",
G_OBJECT_TYPE_NAME (object), object, priv->global_id, priv->pw_proxy); G_OBJECT_TYPE_NAME (object), object, priv->global_id, priv->pw_proxy);
g_clear_pointer (&priv->pw_proxy, pw_proxy_destroy);
g_clear_object (&priv->task); g_clear_object (&priv->task);
g_clear_pointer (&priv->global_props, wp_properties_unref); g_clear_pointer (&priv->global_props, wp_properties_unref);
g_weak_ref_clear (&priv->core); g_weak_ref_clear (&priv->core);
...@@ -346,6 +357,7 @@ wp_proxy_class_init (WpProxyClass * klass) ...@@ -346,6 +357,7 @@ wp_proxy_class_init (WpProxyClass * klass)
GObjectClass *object_class = (GObjectClass *) klass; GObjectClass *object_class = (GObjectClass *) klass;
object_class->constructed = wp_proxy_constructed; object_class->constructed = wp_proxy_constructed;
object_class->dispose = wp_proxy_dispose;
object_class->finalize = wp_proxy_finalize; object_class->finalize = wp_proxy_finalize;
object_class->get_property = wp_proxy_get_property; object_class->get_property = wp_proxy_get_property;
object_class->set_property = wp_proxy_set_property; object_class->set_property = wp_proxy_set_property;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment