Review Request: Quit Eventloop before emitting finished and result signals
Raphael Kubo da Costa
kubito at gmail.com
Wed Dec 9 01:22:35 GMT 2009
On Wednesday 11 November 2009 16:38:42 Sebastian Sauer wrote:
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/2140/
> -----------------------------------------------------------
>
> Review request for kdelibs.
>
>
> Summary
> -------
>
> If KJob::exec is called then it can happen that the result(KJob*) signal is
> emitted before the QEventLoop in KJob::exec is quit. If a slot connected
> with the result(KJob*) signal does then e.g. call the same KJob::exec
> again then funny things may happen. The patch introduces a new internal
> signal that is called before the finished and result signals are emitted
> and that quits the eventloop. This way we can be sure that the finished
> and result signals are always emitted once the eventloop is done.
>
>
> Diffs
> -----
>
> /trunk/KDE/kdelibs/kdecore/jobs/kjob.h 1047234
> /trunk/KDE/kdelibs/kdecore/jobs/kjob.cpp 1047234
>
> Diff: http://reviewboard.kde.org/r/2140/diff
>
>
> Testing
> -------
>
>
> Thanks,
>
> Sebastian
>
I believe this commit is causing bug 217836: basically, d->eventLoop::quit()
is called inside KJob::emitResult(), however the slot connected to the
result() signal is called long after the method which called KJob::exec()
finished, thus causing a segfault because the slot tries to access data that's
no longer present.
If I use my own QEventLoop instead of calling KJob::exec() or revert this
commit, the segfault doesn't happen.
Am I doing something unusual here?
More information about the kde-core-devel
mailing list