[Bug 291201] ktp-contactlist crashes when setting status to "Offline"

David Edmundson kde at davidedmundson.co.uk
Thu Jan 19 01:30:48 UTC 2012


https://bugs.kde.org/show_bug.cgi?id=291201





--- Comment #10 from David Edmundson <kde davidedmundson co uk>  2012-01-19 01:30:48 ---
Right. We both made this supercomplicated when it turned out to be really
really easy when we look in the right place.

QModelIndex.isValid() simply checks model exists and that rows + columns are
non negative, it's not a continual check that works forever. It possibly checks
< rowCount on creation, but it's not checked each time you called isValid();

We had code in the tooltip-manager that:
1) saved a qmodelindex
2) waited a bit
3) used that modelindex

You should /never ever ever/ store a QModelIndex.

Patch
-    QModelIndex        item;
+    QPersistentModelIndex        item;

isValid now updates correctly so we don't crash.
Seems to fix it. If you test it, tomorrow I'll ship it if you're happy enough.

Alternate fix is to re-request the model index in prepareToolTip.

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


More information about the KDE-Telepathy mailing list