Bug 302136

Summary: [PATCH] Gwenview crashes when switching to a subfolder while parent folder is loading thumbnails
Product: [Applications] gwenview Reporter: Benni Hill <benni>
Component: generalAssignee: Gwenview Bugs <gwenview-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: janforemny, kde, simonandric5, yodayado
Priority: NOR    
Version: 2.9.0   
Target Milestone: 2.9   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 2.9.1
Sentry Crash Report:
Attachments: Partially revert commit "Avoid double deletes when using ThumbnailLoadJob::exec()"

Description Benni Hill 2012-06-18 16:24:53 UTC
Application: gwenview (2.9.0)
KDE Platform Version: 4.8.4 (4.8.4) (Compiled from sources)
Qt Version: 4.8.1
Operating System: Linux 3.2.0-25-generic x86_64
Distribution: Ubuntu 12.04 LTS

-- Information about the crash:
Git version: e4e135c Fix images not showing after viewing a video

- What I was doing when the application crashed:
I opened a folder with many images (>100). While gwenview was loading the already created thumbnails of this folder I switched into a subfolder. Gwenview then crashed immediately.

I assume this bug was introduced with commit 200c5a138f4eb17a2e52ce9f972385d04ffbac9c "Avoid double deletes when using ThumbnailLoadJob::exec()". Readding the second delete fixes this bug for me.

The crash can be reproduced every time.

-- Backtrace:
Application: Gwenview (gwenview), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f615f0a07c0 (LWP 29405))]

Thread 4 (Thread 0x7f614a7aa700 (LWP 29407)):
#0  0x00007f61588ea05d in __pthread_mutex_unlock_usercnt (mutex=<optimized out>, decr=<optimized out>) at pthread_mutex_unlock.c:52
#1  __pthread_mutex_unlock (mutex=0x7f6144000a60) at pthread_mutex_unlock.c:290
#2  0x00007f61582615d1 in g_mutex_unlock () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f6158225f4e in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f6158226164 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f615defb426 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007f615decac82 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7  0x00007f615decaed7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#8  0x00007f615ddc9fa7 in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007f615deaa9ff in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#10 0x00007f615ddccfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11 0x00007f61588e6e9a in start_thread (arg=0x7f614a7aa700) at pthread_create.c:308
#12 0x00007f615ba824bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#13 0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7f6149547700 (LWP 29408)):
#0  0x00007fff89c808de in ?? ()
#1  0x00007f61584d715d in __GI_clock_gettime (clock_id=<optimized out>, tp=<optimized out>) at ../sysdeps/unix/clock_gettime.c:116
#2  0x00007f615de23bb4 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3  0x00007f615defbb8d in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007f615defbec3 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#5  0x00007f615defa97c in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6  0x00007f615defaa25 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7  0x00007f6158225846 in g_main_context_prepare () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#8  0x00007f6158225f5b in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#9  0x00007f6158226164 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#10 0x00007f615defb426 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11 0x00007f615decac82 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#12 0x00007f615decaed7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#13 0x00007f615ddc9fa7 in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#14 0x00007f615deaa9ff in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#15 0x00007f615ddccfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#16 0x00007f61588e6e9a in start_thread (arg=0x7f6149547700) at pthread_create.c:308
#17 0x00007f615ba824bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#18 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f6142a9d700 (LWP 29415)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007f615ddcd4db in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2  0x00007f615e9f3e9e in Gwenview::SemanticInfoThread::run (this=0x2251850) at /home/benjamin/software/kde/gwenview/lib/semanticinfo/nepomuksemanticinfobackend.cpp:145
#3  0x00007f615ddccfcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4  0x00007f61588e6e9a in start_thread (arg=0x7f6142a9d700) at pthread_create.c:308
#5  0x00007f615ba824bd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#6  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f615f0a07c0 (LWP 29405)):
[KCrash Handler]
#6  0x00007f615de7f800 in QUrl::QUrl(QUrl const&) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7  0x00007f615c1725f9 in KUrl::KUrl(KUrl const&) () from /usr/lib/libkdecore.so.5
#8  0x00007f615e5861f0 in KFileItem::url() const () from /usr/lib/libkio.so.5
#9  0x00007f615e9e1bc0 in Gwenview::ThumbnailView::setThumbnail (this=0x22daf80, item=..., pixmap=..., size=...) at /home/benjamin/software/kde/gwenview/lib/thumbnailview/thumbnailview.cpp:585
#10 0x00007f615dee0281 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11 0x00007f615e9d295c in Gwenview::ThumbnailLoadJob::thumbnailLoaded (this=<optimized out>, _t1=..., _t2=..., _t3=...) at /home/benjamin/software/kde/gwenview/build/lib/thumbnailloadjob.moc:282
#12 0x00007f615e9d470b in Gwenview::ThumbnailLoadJob::emitThumbnailLoaded (this=0x30c7ae0, img=..., size=...) at /home/benjamin/software/kde/gwenview/lib/thumbnailloadjob.cpp:706
#13 0x00007f615e9d65eb in Gwenview::ThumbnailLoadJob::checkThumbnail (this=0x30c7ae0) at /home/benjamin/software/kde/gwenview/lib/thumbnailloadjob.cpp:636
#14 0x00007f615dee5446 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#15 0x00007f615c6f0894 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#16 0x00007f615c6f5713 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#17 0x00007f615d42a9e6 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#18 0x00007f615decbe9c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#19 0x00007f615decfc6a in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#20 0x00007f615defaf93 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#21 0x00007f6158225d53 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#22 0x00007f61582260a0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007f6158226164 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007f615defb3bf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#25 0x00007f615c798d5e in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#26 0x00007f615decac82 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#27 0x00007f615decaed7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#28 0x00007f615decff67 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#29 0x0000000000426eb5 in main (argc=1, argv=0x7fff89c53848) at /home/benjamin/software/kde/gwenview/app/main.cpp:142

Possible duplicates by query: bug 257633.

Reported using DrKonqi
Comment 1 Benni Hill 2012-06-19 14:58:59 UTC
I could reproduce the crash on Kubuntu 12.10 with KDE 4.8.90.
Comment 2 Benni Hill 2012-06-25 18:04:07 UTC
Created attachment 72133 [details]
Partially revert commit "Avoid double deletes when using ThumbnailLoadJob::exec()"

I forgot the patch.
Comment 3 Aurelien Gateau 2012-06-28 15:54:51 UTC
Hi Benni, thanks for the patch, but I think I fixed it another way in d9dadb8f98ad0dab35c6a997ed5791a4258e6cb0 . Can you still reproduce the bug after this commit?

(BTW: you should use http://git.reviewboard.kde.org to post patches: I am quite bad at bugzilla mail, I process reviewboard requests much faster)
Comment 4 Benni Hill 2012-06-28 17:09:09 UTC
(In reply to comment #3)
> Hi Benni, thanks for the patch, but I think I fixed it another way in
> d9dadb8f98ad0dab35c6a997ed5791a4258e6cb0 .
Yes, this seems to solve it.

> (BTW: you should use http://git.reviewboard.kde.org to post patches: I am
> quite bad at bugzilla mail, I process reviewboard requests much faster)
OK, I'll use reviewboard next time.
Comment 5 Jekyll Wu 2012-07-02 10:07:01 UTC
*** Bug 302881 has been marked as a duplicate of this bug. ***
Comment 6 Jekyll Wu 2012-07-12 13:56:14 UTC
*** Bug 303409 has been marked as a duplicate of this bug. ***
Comment 7 Jekyll Wu 2012-07-18 15:14:13 UTC
*** Bug 303743 has been marked as a duplicate of this bug. ***
Comment 8 Aurelien Gateau 2012-07-20 14:19:00 UTC
Looks like it is still crashing. Reopening.
Comment 9 Janek Bevendorff 2012-07-20 16:25:25 UTC
For me it seems to be fixed with that patch applied.
Comment 10 Aurelien Gateau 2012-07-28 23:10:51 UTC
Git commit 8136f977f6ea9e75f1da201b8c7357b5f8d50da8 by Aurélien Gâteau.
Committed on 29/07/2012 at 01:10.
Pushed by gateau into branch 'KDE/4.9'.

Check mCurrentItem validity before emitting any signal with it

Fix the rare case where item is reset while the thumbnail is being generated
by the thumbnail thread.
FIXED-IN: 2.9.1

M  +12   -0    lib/thumbnailloadjob.cpp

http://commits.kde.org/gwenview/8136f977f6ea9e75f1da201b8c7357b5f8d50da8
Comment 11 Jekyll Wu 2012-08-15 10:09:41 UTC
*** Bug 305185 has been marked as a duplicate of this bug. ***