Bug 340636 - KJob::exec allows UI events to be processed despite documentation claims
Summary: KJob::exec allows UI events to be processed despite documentation claims
Status: RESOLVED WORKSFORME
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdecore (show other bugs)
Version: 4.14.0
Platform: Kubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-04 16:00 UTC by RJVB
Modified: 2018-11-30 04:02 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description RJVB 2014-11-04 16:00:22 UTC
The documentation for KJob::exec states that

"Note that the event loop started by this method does not process user input events, which means your user interface will effectivly be blocked. Other events like paint or network events are still being processed. The advantage of not processing user input events is that the chance of accidental reentrancy is greatly reduced. Still you should avoid calling this function."

Yet it is possible for UI events to "come through" e.g. by clicking on a systray icon as can be seen from this extract of the crash backtrace from https://bugs.kde.org/show_bug.cgi?id=340624 :


#6  0x00007f9f95149ae4 in MailCommon::FolderTreeWidget::folderTreeView (this=<optimized out>, this=<optimized out>) at ../../mailcommon/folder/foldertreewidget.cpp:261
#7  0x00007f9f955043df in folderTreeView (this=<optimized out>, this=<optimized out>) at ../../kmail/kmmainwidget.h:146
#8  KMKernel::treeviewModelSelection (this=<optimized out>) at ../../kmail/kmkernel.cpp:1939
#9  0x00007f9f954efa8e in KMail::KMSystemTray::slotContextMenuAboutToShow (this=0x1675610) at ../../kmail/kmsystemtray.cpp:307
#10 0x00007f9ffb8b795a in QMetaObject::activate (sender=0x178f060, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3567
#11 0x00007f9ffb8aab17 in QMetaMethod::invoke (this=this@entry=0x7fff49f44340, object=object@entry=0x178f060, connectionType=Qt::DirectConnection, connectionType@entry=Qt::AutoConnection, returnValue=..., val0=..., val1=..., val2=..., val3=..., val4=..., val5=..., val6=..., val7=..., val8=..., val9=...) at kernel/qmetaobject.cpp:1664
...
#27 0x00007f9ffb8a5d07 in QCoreApplication::sendPostedEvents (receiver=0x7f9ffb8d3060 <postEventSourceDispatch(GSource*, GSourceFunc, gpointer)>, receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1470
#28 0x00007f9ffb8d3073 in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#29 postEventSourceDispatch (s=0x8ecde0) at kernel/qeventdispatcher_glib.cpp:287
#30 0x00007f9ff4adce04 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007f9ff4add048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007f9ff4add0ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007f9ffb8d270f in QEventDispatcherGlib::processEvents (this=0x8b9bb0, flags=...) at kernel/qeventdispatcher_glib.cpp:434
#34 0x00007f9ffc350d86 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#35 0x00007f9ffb8a05af in QEventLoop::processEvents (this=this@entry=0x7fff49f45260, flags=...) at kernel/qeventloop.cpp:149
#36 0x00007f9ffb8a08ed in QEventLoop::exec (this=0x7fff49f45260, flags=...) at kernel/qeventloop.cpp:204
#37 0x00007f9ffbd38af3 in KJob::exec (this=0x11f0110) at ../../kdecore/jobs/kjob.cpp:210
#38 0x00007f9f9550090b in KMKernel::cleanup (this=0x11a8f20) at ../../kmail/kmkernel.cpp:1311


Reproducible: Always

Steps to Reproduce:
1. start Kontact, wait until it gets blocked on a "Retrieving Folder Contents" without any progress indicator showing activity (preferably start with --nofork from a terminal). Configure it to show the mail indicator systray icon.
2. Quit Kontact through the menu action
3. Observe that the systray icon is still there (and kontact still runs); right-click the systray icon

Actual Results:  
crash because the user input event is not ignored

Expected Results:  
in this context: user event ignored
Comment 1 Christoph Feck 2014-11-16 14:15:40 UTC
Given the insights from the Qt mailing list thread (which I cannot find right now), is this bug still valid?
Comment 2 RJVB 2014-11-16 14:38:01 UTC
You're right, if there's a bug it's probably not in KJob.
Comment 3 Andrew Crouthamel 2018-10-31 03:59:29 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Bug Janitor Service 2018-11-15 10:49:33 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Bug Janitor Service 2018-11-30 04:02:24 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!