[PATCH amarok 1.4] fix threading issues around QImage

Seb Ruiz ruiz at kde.org
Tue Sep 25 00:43:01 CEST 2007


On 24/09/2007, Dirk Mueller <mueller at kde.org> wrote:
>
> Hi,
>
> for a long time at SUSE we got crash reports about amarok that were difficult
> to reproduce, but always happened in heavily multithreaded environments.
> Looking at those with threadchecker, there are many obvious problems:
>
> a) QImage::load is neither reentrant nor threadsafe, and must not be used in
> threads. amarok 1.4 makes heavy use of QImage::load in threads, and this does
> not work because QImage::load uses unsafe iterators and uses a shared
> QRegexp. QRegexp however is not thread-safe (it is reentrant though), which
> causes amarok to crash randomly during playing, whenever one of the new cover
> images is loaded. I`m currently working around that by taking the global
> QApplication: lock, which is the only option I see.
>
> b) KStandardDirs usage in subthreads and GUI thread. I`ve fixed those by
> caching the locate() result in the object and qdeepcopy`ing it before the
> thread is started.
>
> below is the patch, comments etc apprecciated. the diff in
> enginecontroller.cpp is unrelated, please ignore that part.

Hi Dirk,
I've noticed that you've commit most of these fixes already - thanks!

I don't presume that QApplication::lock() will have many adverse side
effects? Obviously it is better than a crash however.

Thanks

-- 
Seb Ruiz

http://www.sebruiz.net/


More information about the Amarok-devel mailing list