[Interest] [Qt4.8] UI events coming through despite QEventLoop::ExcludeUserInputEvents

Andreas Pakulat apaku at gmx.de
Fri Nov 7 12:44:27 CET 2014


Hi,

On Fri, Nov 7, 2014 at 11:10 AM, René J.V. <rjvbertin at gmail.com> wrote:

> I'm using KDE's KMail on Linux and Mac OS X, and I've been dealing with
> crashes on both platform when UI events "come through" during the shutdown
> phase.
>
> Specifically, KMail's cleanup procedure runs a few so-called KJobs (a
> class which inherits QObject) using a member function which calls
> QEventLoop::exec(QEventLoop::ExcludeUserInputEvents) . From what I
> understand, that flag should prevent UI events from being sent to the
> client code, but reality is clearly different; see for instance
> https://bugs.kde.org/show_bug.cgi?id=340680 for a backtrace.
>

Looking at that backtrace I don't see UserInput events. At least
QTimerInfoList::activateTimers suggests a QTimer fires, thats not a
UserInput nor a UserInterface event.


> I can of course try to patch each event handler before it accesses
> released memory while shutting down, but that's a bit too much like mopping
> with the tap open.
> What am I missing (or rather, what have the people maintaining KJob missed
> :) )?
>

I'd say at least the above backtrace is an application bug. I can't say
wether the timer that triggers the update of the folder menu should have
been stopped already or just the FolderTreeWidget should double-check its
(selection)model instead of assuming its always ok. To me this looks like
the shutdown order of things in this application is not properly defined,
i.e. something deletes the selection model and/or the itemmodel but does
not clean up other things connected to that.

I'd also question the usage of KJob::exec (I assume thats where the
processEvents comes from, as everything else in the API does not sound like
it would need that). Whats the point of putting things into a KJob if you
then essentially do a synchronous run? Just put the functionality thats
inside the job's run function into a utility function and call that
directly. Or does that cleanup really need a Qt event loop running?

Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20141107/ae2e3da3/attachment.html>


More information about the Interest mailing list