modules: unregister the endpoints when their proxy is destroyed
This commit is contained in:
@@ -76,6 +76,16 @@ proxy_info_destroy(gpointer p)
|
||||
g_slice_free (struct proxy_info, p);
|
||||
}
|
||||
|
||||
static void
|
||||
unregister_endpoint (WpProxy* wp_proxy, WpEndpoint *endpoint)
|
||||
{
|
||||
g_return_if_fail(WP_IS_PROXY(wp_proxy));
|
||||
g_return_if_fail(WP_IS_ENDPOINT(endpoint));
|
||||
|
||||
/* Unregister the endpoint */
|
||||
wp_endpoint_unregister(endpoint);
|
||||
}
|
||||
|
||||
static void
|
||||
proxy_node_created(GObject *initable, GAsyncResult *res, gpointer d)
|
||||
{
|
||||
@@ -123,6 +133,10 @@ proxy_node_created(GObject *initable, GAsyncResult *res, gpointer d)
|
||||
/* Register the endpoint */
|
||||
wp_endpoint_register (endpoint);
|
||||
|
||||
/* Set destroy handler to unregister endpoint when the proxy is detroyed */
|
||||
g_signal_connect (proxy_node, "destroyed", G_CALLBACK(unregister_endpoint),
|
||||
endpoint);
|
||||
|
||||
/* Clean up */
|
||||
proxy_info_destroy (pi);
|
||||
}
|
||||
|
@@ -70,6 +70,16 @@ proxy_info_destroy(gpointer p)
|
||||
g_slice_free (struct proxy_info, p);
|
||||
}
|
||||
|
||||
static void
|
||||
unregister_endpoint (WpProxy* wp_proxy, WpEndpoint *endpoint)
|
||||
{
|
||||
g_return_if_fail(WP_IS_PROXY(wp_proxy));
|
||||
g_return_if_fail(WP_IS_ENDPOINT(endpoint));
|
||||
|
||||
/* Unregister the endpoint */
|
||||
wp_endpoint_unregister(endpoint);
|
||||
}
|
||||
|
||||
static void
|
||||
proxy_node_created(GObject *initable, GAsyncResult *res, gpointer data)
|
||||
{
|
||||
@@ -114,6 +124,10 @@ proxy_node_created(GObject *initable, GAsyncResult *res, gpointer data)
|
||||
/* Register the endpoint */
|
||||
wp_endpoint_register (endpoint);
|
||||
|
||||
/* Set destroy handler to unregister endpoint when the proxy is detroyed */
|
||||
g_signal_connect (proxy_node, "destroyed", G_CALLBACK(unregister_endpoint),
|
||||
endpoint);
|
||||
|
||||
/* Clean up */
|
||||
proxy_info_destroy (pi);
|
||||
}
|
||||
|
Reference in New Issue
Block a user