Review Request 107650: Don't call exec() on KIO::MimetypeJob

Aaron J. Seigo aseigo at kde.org
Tue Jan 15 14:32:07 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107650/
-----------------------------------------------------------

(Updated Jan. 15, 2013, 2:32 p.m.)


Review request for Plasma, Aaron J. Seigo and Giorgos Tsiapaliokas.


Description
-------

The doc say:

bool KJob::exec	()

"Executes the job synchronously.
This will start a nested QEventLoop internally. Nested event loop can be dangerous and can have unintended side effects, you should avoid calling exec() whenever you can and use the asyncronous interface of KJob instead.
Should you indeed call this method, you need to make sure that all callers are reentrant, so that events delivered by the inner event loop don't cause non-reentrant functions to be called, which usually wreaks havoc.
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."

So, I replaced it by using SIGNAL-SLOT.


Diffs
-----

  plasmate/editors/editpage.h 5cb3ea6 
  plasmate/editors/editpage.cpp 7e82ff2 

Diff: http://git.reviewboard.kde.org/r/107650/diff/


Testing
-------

Plasmate has the same behavior with and without this patch, but this is more robust IMHO.


Thanks,

Andrea Scarpino

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20130115/48d0aaca/attachment.html>


More information about the Plasma-devel mailing list