Bug 494242 - Crash when trying to edit a contact
Summary: Crash when trying to edit a contact
Status: RESOLVED FIXED
Alias: None
Product: kaddressbook
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2024-10-07 14:14 UTC by Simon Brown
Modified: 2024-10-10 18:27 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
New crash information added by DrKonqi (80.97 KB, text/plain)
2024-10-07 14:14 UTC, Simon Brown
Details
Patch to fix the crash (2.25 KB, patch)
2024-10-09 20:24 UTC, Jonathan Marten
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Brown 2024-10-07 14:14:36 UTC
Application: kaddressbook (6.2.1 (24.08.1))

Qt Version: 6.7.2
Frameworks Version: 6.6.0
Operating System: Linux 6.8.0-45-generic x86_64
Windowing System: X11
Distribution: KDE neon 6.1
DrKonqi: 6.1.5 [CoredumpBackend]

-- Information about the crash:
I created a new contact by right clicking on an email address in Kmail and filled out some information and closed the dialog.

Then I opened Kaddressbook searched by first name and tried to edit the contact to add some more information. The edit dialog would appear for a moment before the app crashed. This was repeatable, I could restart kaddressbook, search and press edit to repeat the crash.

I have now made the changes I wanted using mekuro contacts and the crash no longer occurs.

The crash can be reproduced every time.

-- Backtrace (Reduced):
#6  __pthread_kill_implementation (no_tid=0, signo=6, threadid=128972826141248) at ./nptl/pthread_kill.c:44
#7  __pthread_kill_internal (signo=6, threadid=128972826141248) at ./nptl/pthread_kill.c:78
#8  __GI___pthread_kill (threadid=128972826141248, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#9  0x0000754cdba42476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#10 0x0000754cdba287f3 in __GI_abort () at ./stdlib/abort.c:79


Reported using DrKonqi
Comment 1 Simon Brown 2024-10-07 14:14:37 UTC
Created attachment 174505 [details]
New crash information added by DrKonqi

DrKonqi auto-attaching complete backtrace.
Comment 2 Jonathan Marten 2024-10-09 20:24:52 UTC
Created attachment 174589 [details]
Patch to fix the crash

Can confirm this happening.  It seems to be when the contact entry being edited has a phone number type which is not one of the standard ones ("Home", "Work" etc).  In this case Akonadi::PhoneComboBoxType::setType() in src/akonadi-contacts-widgets/editor/generalinfoeditor/phone/phonecomboboxtype.cpp tries to insert the previously unknown type into mTypeList as the penultimate entry.  The code looks correct to me (although it's a bit clumsy), but it crashes with the assert as per the backtrace.

The attached patch appears to fix the problem, although there may be a better way.
Comment 3 Bug Janitor Service 2024-10-10 08:35:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/pim/akonadi-contacts/-/merge_requests/48
Comment 4 Jonathan Marten 2024-10-10 18:27:00 UTC
Git commit f11e81cebba7956f0b0aca27420ab66d7da2b602 by Jonathan Marten.
Committed on 10/10/2024 at 08:29.
Pushed by marten into branch 'master'.

Fix KAddressBook crash when editing a contact with nonstandard phone type

In this case PhoneComboBoxType::setType() attempts to insert the new
type as the penultimate item in the mTypeList.  However, using an
iterator for insertion appears to cause an assertion within QList.
There is no need to obtain an interator to do the insertion, the index
can be used directly.

Test case: Importing this contact into KAddressBook and attempting to
edit it will trigger the crash.

VERSION:3.0
EMAIL;TYPE=PREF,WORK:foo@bar.com
EMAIL;TYPE=WORK:info@bar.com
FN:Foo Bar
N:Bar;Foo;;Mx.;
TEL;TYPE=CELL,WORK:0000 000 0000
TEL;TYPE=HOME:01000 000000
END:VCARD

M  +1    -1    src/akonadi-contacts-widgets/editor/generalinfoeditor/phone/phonecomboboxtype.cpp

https://invent.kde.org/pim/akonadi-contacts/-/commit/f11e81cebba7956f0b0aca27420ab66d7da2b602