[Bug 35747] Crash on contactPtr->id() and contactPtr is not 0

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Apr 7 14:02:26 CEST 2011


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

Olli Salli <ollisal at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |NOTOURBUG

--- Comment #5 from Olli Salli <ollisal at gmail.com> 2011-04-07 05:02:26 PDT ---
If the code is exactly that, then the issue is that you aren't waiting for the
PendingContacts to finish. Just like any other PendingOperation, you must
connect the finished(Tp::PendingOperation *) signal to a slot, and extract the
result when that slot has been invoked, after you've checked that the operation
was finished successfully (it might, in particular finish with a failure e.g.
if you pass an invalid ID to it, or due to an internal error in the connection
manager D-Bus service).

If you try to extract information from the PendingContacts right after it has
been created (at which point no D-Bus calls have been able to be made yet), its
contacts() accessor will most likely return an empty list. Calling first() on
an empty QList results in uninitialized behavior, namely either crashing or
returning completely random data (in this case a random ContactPtr). Hence you
getting an invalid ContactPtr.

I strongly suggest adopting the use of Valgrind or other memory error checking
tools. In this case, it would have reported that your call to
QList<ContactPtr>::first() accessed uninitialized, or not-allocated memory.

As for having no time, surely as a developer you must appreciate the fact that
to be able to investigate bugs, one must have adequate information on how to
reproduce the issue? A way to reproduce an issue being the essence of what a
bug is about, anyway. And as this is a memory corruption bug, adequate
information either is a full testcase for producing the memory state which
triggers the issue, or a report from a memory access checker tool which has
already analyzed potential issues in the memory usage pattern.

Closing the bug. Please reopen if, having followed these steps, the problem
still persists.

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



More information about the telepathy-bugs mailing list