Crash when using KIdentityManagement::IdentityManager
Volker Krause
vkrause at kde.org
Tue Apr 13 19:21:21 BST 2021
On Dienstag, 13. April 2021 17:47:47 CEST Carl Schwan wrote:
> Hello folks,
>
> I have been trying to implement a mail client based on Akonadi
> for the PinePhone. I'm currently getting blocked by a weird
> crash in KIdentityManagement::IdentityManager.
>
> The code can be found here:
> https://invent.kde.org/carlschwan/quickmail/-/blob/master/src/main.cpp#L46
>
> valgrind/gdb tells me that the d pointer of the IdentityManager is
> inaccessible when calling constEnd/Begin(). But then adding the exact same
> code as a test case in KIdentityManagement, it works without any crash.
>
> Does anyone with a bit more experience in C++ can help me?
Summary of the discussion on chat:
It's an ABI issue on methods returning a QVector::[const_]iterator, and
KIdentityManagement being built with QT_STRICT_ITERATORS enabled (via KF
default settings), while the application didn't have that set.
The effect then, as usual with ABI issues, is absolutely bizarre (the this
pointer seemingly changing from one step to the next here).
Credit goes to Harald for identifying the return type as the key to the
problem.
I'm wondering now what the lesson for ABI compatibility in general is from
this:
* do not use QVector iterator types in public API? do we even do that in KF?
* do not set QT_STRICT_ITERATOR? what if the consuming code has it set though?
* only allow QVector iterators in public API inline code (so it entirely
follows QT_STRICT_ITERATOR as set on the outside)?
Regards,
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20210413/ea9268d1/attachment.sig>
More information about the kde-pim
mailing list