Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 686842

Summary: kde-apps/kmail-18.12.3-r1: crashes when closing message
Product: Gentoo Linux Reporter: Erik Quaeghebeur <gentoo>
Component: Current packagesAssignee: Gentoo KDE team <kde>
Status: RESOLVED FIXED    
Severity: normal CC: giuseppe
Priority: Normal Keywords: PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://phabricator.kde.org/D19559
See Also: https://bugs.kde.org/show_bug.cgi?id=400838
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: kmail gdb trace
messagelib patch

Description Erik Quaeghebeur 2019-05-27 09:29:55 UTC
Since the recent updates of Qt, KDE Frameworks and KDE Plasma, stable kmail crashes if one closes a message opened in a separate window. (One can do this by double-clicking a message.)

See also: https://marc.info/?t=155893811800005&r=1&w=2
Comment 1 Erik Quaeghebeur 2019-05-27 10:19:33 UTC
added upstream report
Comment 2 Giuseppe Vitillaro 2019-05-27 18:06:14 UTC
I'm experimenting the very same problem, again in ~WebContentsAdapter() destructor, SEGFAULT, verified with gdb, qtwebengine-5.12.3, kmail-18.12.3-r1, stable Gentoo.

In the source qtwebengine-everywhere-src-5.12.3/src/core/web_contents_adapter.cpp there is one and only one ~WebContentsAdapter() destructor, at line 1677:

WebContentsAdapter::~WebContentsAdapter()
{
    if (m_devToolsFrontend)
        closeDevToolsFrontend();
    Q_ASSERT(!m_devToolsFrontend);
}


The source is quite different from previous version 5.11.3:

WebContentsAdapter::~WebContentsAdapter()
{
    Q_D(WebContentsAdapter);
    if (d->devToolsFrontend)
        closeDevToolsFrontend();
    Q_ASSERT(!d->devToolsFrontend);
}

although the logic seems quite the same.

I can't see any backtrace call, with gdb, to the closeDevToolsFrontend() method, but the library doesn't contain any debug info, at the moment.

Do you think emerging qtwebengine-5.12.3 with USE=debug may help debugging this problem?

If the method closeDevToolsFrontend() was actually never called, it looks the SEGFAULT may arise because m_devToolsFrontend is not a null pointer, but it is not actually pointing to a valid memory area.

Maybe the Q_D() preprocessor macro, in the previous version, added some logic preventing the SEGFAULT?
Comment 3 Giuseppe Vitillaro 2019-05-28 09:16:36 UTC
A question. 

I've a couple of systems which I actually need to update, where I use kmail for my daily duty.

In the meanwhile the problem is analyzed and solved, may I mask qt-5.12 with

dev-qt/*:5/5.12

and go on with my emerge to the last stable version, keeping kmail running with qt-5.11.3-r2?

I tested this configuration on one of my systems and it would emerge/update world, apparently.
Comment 4 Giuseppe Vitillaro 2019-05-29 10:06:04 UTC
Created attachment 577976 [details]
kmail gdb trace

Now I've a more meaningful gdb trace (with kmail and qtwebengine symbols) of the kmail SEGFAULT, I hope it may help to debug the problem.

The fault seems to begin its road at 

src/webenginewidgets/api/qwebenginepage.cpp:263

QWebEnginePagePrivate::~QWebEnginePagePrivate()
{
    delete history;
    delete settings;
    profile->d_ptr->removeWebContentsAdapterClient(this);
}
Comment 5 Giuseppe Vitillaro 2019-05-29 18:07:32 UTC
Created attachment 578010 [details, diff]
messagelib patch

It looks the problem is neither in kmail, neither in qtwebengine-5.12.3, apologies for my previous comments.

The smoking gun seems to be kde-apps/messagelib-18.12.3-r1, in its interface to qtwebengine-5.12.3, which is changed.

Reading this thread: 

https://phabricator.kde.org/D19559

I realized that the problem is probably solved in the unstable kde-apps 19.04.1 (to which kmail belongs).

Anyway, from the "phabricator" thread, from its raw diff patch, with a minor change to the copyright date, I had been able to write down the attached user patch "msglib.patch" for the stable kde-apps/messagelib-18.12.3-r1 version.

With this user patch applied, kmail doesn't segfault anymore, closing a message window or even the main window (which share the same problem).

Not sure about what to do.

Waiting for 19.04.1 to become stable?

Installing the unstable version to my stable Gentoo?

Using this patch?
Comment 6 Andreas Sturmlechner gentoo-dev 2019-05-30 12:38:55 UTC
Thanks for identifying the fix! Meanwhile I also found a system to successfully reproduce the problem.
Comment 7 Andreas Sturmlechner gentoo-dev 2019-05-30 13:31:00 UTC
Clean backport of https://phabricator.kde.org/D19559 (no changes required) fixes the issue for me.
Comment 8 Giuseppe Vitillaro 2019-05-31 11:37:37 UTC
Thank you so much for your efforts Andreas, appreciated.

kmail, especially if used with "kontact", it is really a wonderful tool, a little bit complex actually. I can't find anything else matching the features of the kontact office suite elsewhere, at least under Gentoo Linux.

The only problem is in its complexity: there are layers and layers of packages between the application interface and the operating system.

I would really appreciate, as I use the suite for my daily duty, if the Gentoo team shall be a little bit more cautios about stabilization, in the future.

Being without a working mail interface for days, waiting for a fix, may be a BIG trouble for a real kmail user, like me.

And, under Gentoo, a monthly emerge can't be postponed for weeks ;-(

Thanks again, G. Vitillaro.
Comment 9 Larry the Git Cow gentoo-dev 2019-06-01 08:42:49 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8e77815125e73f7baf630855845a5f4bb041e51

commit a8e77815125e73f7baf630855845a5f4bb041e51
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2019-06-01 08:38:46 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2019-06-01 08:42:37 +0000

    kde-apps/messagelib: Fix messagewindow crash with Qt 5.12.3
    
    Reported-by: Erik Quaeghebeur <gentoobugzilla@equaeghe.nospammail.net>
    Thanks-to: Giuseppe Vitillaro <giuseppe@vitillaro.org>
    Closes: https://bugs.gentoo.org/686842
    Package-Manager: Portage-2.3.67, Repoman-2.3.13
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 .../messagelib-18.12.3-qtwebengine-5.12.3.patch    | 172 +++++++++++++++++++++
 kde-apps/messagelib/messagelib-18.12.3-r2.ebuild   |  71 +++++++++
 2 files changed, 243 insertions(+)
Comment 10 Giuseppe Vitillaro 2019-06-01 10:32:27 UTC
(In reply to Larry the Git Cow from comment #9)
> The bug has been closed via the following commit(s):
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=a8e77815125e73f7baf630855845a5f4bb041e51
> 
> commit a8e77815125e73f7baf630855845a5f4bb041e51
> Author:     Andreas Sturmlechner <asturm@gentoo.org>
> AuthorDate: 2019-06-01 08:38:46 +0000
> Commit:     Andreas Sturmlechner <asturm@gentoo.org>
> CommitDate: 2019-06-01 08:42:37 +0000
> 
>     kde-apps/messagelib: Fix messagewindow crash with Qt 5.12.3
>     
>     Reported-by: Erik Quaeghebeur <gentoobugzilla@equaeghe.nospammail.net>
>     Thanks-to: Giuseppe Vitillaro <giuseppe@vitillaro.org>
>     Closes: https://bugs.gentoo.org/686842
>     Package-Manager: Portage-2.3.67, Repoman-2.3.13
>     Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
> 
>  .../messagelib-18.12.3-qtwebengine-5.12.3.patch    | 172
> +++++++++++++++++++++
>  kde-apps/messagelib/messagelib-18.12.3-r2.ebuild   |  71 +++++++++
>  2 files changed, 243 insertions(+)

Thanks! I applied the messagelib-18.12.3-qtwebengine-5.12.3.patch published in messagelib-18.12.3-r2 to messagelib-18.12.3-r1, as a user patch, and it works nicely, fixing the problem.

My next June monthly gentoo emerge/update will find it ready in Gentoo portage, if this will be the case.

Fixed! Appreciated! G. Vitillaro.