Xig

Merge lp:~smspillaz/xig/xig.disconnect-signals into lp:xig

Proposed by Sam Spilsbury
Status: Work in progress
Proposed branch: lp:~smspillaz/xig/xig.disconnect-signals
Merge into: lp:xig
Prerequisite: lp:~smspillaz/xig/xig.clean-up-after-clients
Diff against target: 43 lines (+26/-0)
1 file modified
src/xig-server.c (+26/-0)
To merge this branch: bzr merge lp:~smspillaz/xig/xig.disconnect-signals
Reviewer Review Type Date Requested Status
Robert Ancell Needs Fixing
Review via email: mp+89535@code.launchpad.net

Description of the change

Disconnect signals the remote client is interested in when it goes away.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

From me via IRC:

"What you really should do is the server should connected to the destroyed signal for the resources and remove them that way
 so you're explicitly destroying the references from both sides, but the server should be implicitly destroying them
 (or the other way around). The patch has both the server and client responsible which is dangerous if one of them gets out of sync.

So there's two ways we can do this - the client destroys itself, and the server detects that and destroys all its resources, or the client destroys all its resources then itself, and the server doesn't care"

and Sam said "So I think the best way to handle this is to have a XigClientResource which XigSelection and XigDrawable inherit"

Which is correct.

review: Needs Fixing
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Whoops wrong merge. This merge is just blocked on the other one

Unmerged revisions

256. By Sam Spilsbury

Disconnect stale signals too to avoid a race where the signals are dispatched
after the remote client is unrefd

255. By Sam Spilsbury

Clean up after clients - remove stale resource id's and selections. Also
handle the edge case where clients die and leave stuff behind.

254. By Sam Spilsbury

Write message length according to format, not actual length as that's too much

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/xig-server.c'
2--- src/xig-server.c 2012-01-21 13:31:23 +0000
3+++ src/xig-server.c 2012-01-21 13:31:23 +0000
4@@ -189,6 +189,20 @@
5 g_hash_table_remove (server->priv->drawables, GINT_TO_POINTER (xig_drawable_get_id (XIG_DRAWABLE (pixmap))));
6 }
7
8+static void
9+xig_disconnect_client_recursive (XigRemoteClient *client, XigWindow *window)
10+{
11+ GList *children = xig_window_get_children (window);
12+
13+ g_signal_handlers_disconnect_matched (window, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, client);
14+
15+ while (children)
16+ {
17+ XigWindow *child = XIG_WINDOW (children->data);
18+ xig_disconnect_client_recursive (client, child);
19+ children = g_list_next (children);
20+ }
21+}
22
23 static void
24 xig_remote_client_disconnected_cb (XigRemoteClient *client, XigServer *server)
25@@ -220,6 +234,18 @@
26 list = g_list_next (list);
27 }
28
29+ GList *screens = server->priv->screens;
30+
31+ while (screens)
32+ {
33+ XigScreen *screen = (XigScreen *) screens->data;
34+ XigWindow *root = xig_screen_get_root (screen);
35+
36+ xig_disconnect_client_recursive (client, root);
37+
38+ screens = g_list_next (screens);
39+ }
40+
41 g_list_free (orig);
42
43 g_object_unref (client);

Subscribers

People subscribed via source and target branches