Summary: | Correctly deal with removing name owner watches during dispatch of their callbacks | ||
---|---|---|---|
Product: | Telepathy | Reporter: | Will Thompson <will> |
Component: | tp-glib | Assignee: | Simon McVittie <smcv> |
Status: | RESOLVED FIXED | QA Contact: | Telepathy bugs list <telepathy-bugs> |
Severity: | normal | ||
Priority: | medium | Keywords: | patch |
Version: | 0.12 | ||
Hardware: | Other | ||
OS: | All | ||
URL: | http://git.collabora.co.uk/?p=user/smcv/telepathy-glib-smcv.git;a=shortlog;h=refs/heads/012-noc-fixes | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Will Thompson
2010-12-14 07:59:56 UTC
Oh, and here's a patch I ended up using while debugging. The linked branch is against 0.12; but this patch is against master. http://git.collabora.co.uk/?p=user/wjt/telepathy-glib.git;a=commitdiff;h=refs/heads/disable-sigalrm One thing that worries me about this is that we're inventing quarks for bus names. In situations where connections randomize bus names (Idle?) or where we watch unique bus names (seeing whether something crashed), we'll end up allocating an unbounded number of quarks. I do like the idea of using signals for this, but perhaps we can't. For what it's worth, GDBus doesn't. (In reply to comment #1) > Oh, and here's a patch I ended up using while debugging. The linked branch is > against 0.12; but this patch is against master. > http://git.collabora.co.uk/?p=user/wjt/telepathy-glib.git;a=commitdiff;h=refs/heads/disable-sigalrm Perhaps that function could return without either setting up the g_timeout or SIGALRM, if TP_TESTS_DISABLE_TIMEOUT is set? I'd be happy to merge that in master, or indeed in 0.12 since it's only test code. (In reply to comment #3) > or indeed in 0.12 since it's only test code. it didn't exist in 0.12 :) How about these? http://git.collabora.co.uk/?p=user/smcv/telepathy-glib-smcv.git;a=commitdiff;h=refs/heads/timeout http://git.collabora.co.uk/?p=user/smcv/telepathy-glib-smcv.git;a=shortlog;h=refs/heads/012-noc-fixes (In reply to comment #5) > How about these? > > http://git.collabora.co.uk/?p=user/smcv/telepathy-glib-smcv.git;a=commitdiff;h=refs/heads/timeout ++ > http://git.collabora.co.uk/?p=user/smcv/telepathy-glib-smcv.git;a=shortlog;h=refs/heads/012-noc-fixes + for (i = 1; i <= array->len; i++) + { + _NameOwnerSubWatch *entry = &g_array_index (array, + _NameOwnerSubWatch, array->len - i); + + if (entry->callback != NULL) + continue; + + if (entry->destroy != NULL) + entry->destroy (entry->user_data); + + g_array_remove_index (array, array->len - i); + } As discussed in real life, this loop doesn't work; if you remove element 3 in the array, then element 2 will not be examined. The fix is to iterate like this: for (i = array->len; i > 0; i--) { _NameOwnerSubWatch *entry = &g_array_index (array, _NameOwnerSubWatch, i - 1); ... } The test can test this by doing something clever in its GDestroyNotify. The other loop that iterates backwards should also be changed to iterate like this. It's clearer. (In reply to comment #6) > (In reply to comment #5) > > How about these? > > > > http://git.collabora.co.uk/?p=user/smcv/telepathy-glib-smcv.git;a=commitdiff;h=refs/heads/timeout Merged. Fixed in git for 0.12.7 and 0.13.10, release o'clock tomorrow probably. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.