[Bug 30430] New: Make wocky_implement_finish_* macros safer

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Sep 28 18:31:11 CEST 2010


https://bugs.freedesktop.org/show_bug.cgi?id=30430

           Summary: Make wocky_implement_finish_* macros safer
           Product: Wocky
           Version: git master
          Platform: Other
               URL: http://git.collabora.co.uk/?p=user/nicolas/wocky.git;a
                    =shortlog;h=refs/heads/finish
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: medium
         Component: General
        AssignedTo: telepathy-bugs at lists.freedesktop.org
        ReportedBy: nicolas.dufresne at collabora.co.uk
         QAContact: telepathy-bugs at lists.freedesktop.org


wocky_implement_finish_* macros have several issues that may lead to unsafe
operations. As it is related, I also notice that some cancellable are not
handled properly.

1. _is_valid() is called after _propagate_error()

This is done this way because g_simple_async_report_in_idle() lakes a parameter
for the source tag. This has been discussed with the GLib people and the best
solution is not to use it. A exception to _is_valid() might be added but that
would only come in the next cycle. Patch 001 removes the use of
g_simple_async_report_in_idle() allowing _is_valid() to be called first as it's
supposed. The advantage of such solution is that we don't force anybody into
bumping to bleeding edge GLib.

2. Cancellable are not always reffed during the async calls

When cancelling a call, it is correct to do "g_cancellable_cancel(c);
g_object_unref (c);". Some of the async functions are not safe for that since
they don't acquire a reference on the cancellable. Patch 002 fixes all the
calls that where not doing proper ref/unref of cancellables.

3. The macro is missing scope

The macros are missing a scope (do { ... } while (0)) which is also used to
force usage of ; at the end of macro call. Patch 003 does that along with
calling _is_valid() first and allowing g_object_unref to be a valid copy_func.
g_object_unref does not support NULL as parameter.

[001]
http://git.collabora.co.uk/?p=user/nicolas/wocky.git;a=commit;h=ca404f4e6e67b7f9aad0f1824cc1de1480e213de

[002]
http://git.collabora.co.uk/?p=user/nicolas/wocky.git;a=commit;h=df876bc74322b7cd61d0691a20e281891a822318

[003]
http://git.collabora.co.uk/?p=user/nicolas/wocky.git;a=commit;h=df876bc74322b7cd61d0691a20e281891a822318

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.



More information about the telepathy-bugs mailing list