Bug 109946 - Crash when saving a picture after normalization
Summary: Crash when saving a picture after normalization
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: ImageEditor-Canvas (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-31 18:09 UTC by Carsten Niehaus
Modified: 2022-01-25 15:45 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 7.6.0


Attachments
Patch to fix crash when histogram is visible (810 bytes, patch)
2005-08-09 19:33 UTC, Owen Hirst
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Niehaus 2005-07-31 18:09:57 UTC
Version:           0.8-pre svn from 28 July 2005 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc (GCC) 3.3.5 (Debian 1:3.3.5-8ubuntu2) 
OS:                Linux

This crash happen when I was in the image editor. I was in Fix->Colors->Auto Correction. The KComboBox was "Normalize". I 'ok'ed the dialog and saved the picture. On the shell I got this output.

digikam: Saving to :/home/carsten/Bilder/Examen/81kjsb.tmp (jpeg)
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = digikam path = <unknown> pid = 29616


This is the backtrace:




Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
`system-supplied DSO at 0xffffe000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1237484992 (LWP 29616)]
[New Thread -1239688272 (LWP 30407)]
0xffffe410 in __kernel_vsyscall ()
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb683100e in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb6aa7d30 in QThread::wait () from /usr/share/qt3/lib/libqt-mt.so.3
#3  0xb7f2efbc in Digikam::ImageHistogram::stopCalcHistogramValues (
    this=0xfffffffc) at imagehistogram.cpp:91
#4  0xb7f2eedd in ~ImageHistogram (this=0x8604ff8) at imagehistogram.cpp:74
#5  0xb7f8215a in Canvas::updateHistogram (this=0x85c8318) at canvas.cpp:457
#6  0xb7f81c51 in Canvas::load (this=0x85c8318, filename=@0xfffffffc)
    at canvas.cpp:365
#7  0xb7f9489d in ImageWindow::slotLoadCurrent (this=0x8607ed0) at kurl.h:361
#8  0xb7f9ac23 in ImageWindow::qt_invoke (this=0x8607ed0, _id=72, 
    _o=0xbfffef80) at imagewindow.moc:213
#9  0xb6b0b067 in QObject::activate_signal ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#10 0xb6e261a5 in QSignal::signal () from /usr/share/qt3/lib/libqt-mt.so.3
#11 0xb6b23ca9 in QSignal::activate () from /usr/share/qt3/lib/libqt-mt.so.3
#12 0xb6b2ad71 in QSingleShotTimer::event ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#13 0xb6ab3370 in QApplication::internalNotify ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#14 0xb6ab29d4 in QApplication::notify () from /usr/share/qt3/lib/libqt-mt.so.3
#15 0xb70c1735 in KApplication::notify (this=0xbffff630, receiver=0x82503c8, 
    event=0xbffff390) at kapplication.cpp:549
#16 0xb6aa3858 in QEventLoop::activateTimers ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#17 0xb6a5f95f in QEventLoop::processEvents ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#18 0xb6ac474c in QEventLoop::enterLoop ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#19 0xb6ac460e in QEventLoop::exec () from /usr/share/qt3/lib/libqt-mt.so.3
#20 0xb6ab357b in QApplication::exec () from /usr/share/qt3/lib/libqt-mt.so.3
#21 0x0804a3ea in main (argc=-4, argv=0xfffffffc) at main.cpp:252
Comment 1 Carsten Niehaus 2005-07-31 18:11:38 UTC
I forgot to mention: The file was saved correctly :)
Comment 2 Carsten Niehaus 2005-07-31 18:16:32 UTC
Ok, I tried again with another picture, it crashed again. Then I tried it with another filter (sharpnes), again a crash. Here are the new backtraces:

Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
`system-supplied DSO at 0xffffe000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1237484992 (LWP 4854)]
[New Thread -1248080976 (LWP 4920)]
0xffffe410 in __kernel_vsyscall ()
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb683100e in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb6aa7d30 in QThread::wait () from /usr/share/qt3/lib/libqt-mt.so.3
#3  0xb7f2efbc in Digikam::ImageHistogram::stopCalcHistogramValues (
    this=0xfffffffc) at imagehistogram.cpp:91
#4  0xb7f2eedd in ~ImageHistogram (this=0x8525008) at imagehistogram.cpp:74
#5  0xb7f8215a in Canvas::updateHistogram (this=0x85393e0) at canvas.cpp:457
#6  0xb7f81c51 in Canvas::load (this=0x85393e0, filename=@0xfffffffc)
    at canvas.cpp:365
#7  0xb7f9489d in ImageWindow::slotLoadCurrent (this=0x848ad70) at kurl.h:361
#8  0xb7f9ac23 in ImageWindow::qt_invoke (this=0x848ad70, _id=72, 
    _o=0xbfffef80) at imagewindow.moc:213
#9  0xb6b0b067 in QObject::activate_signal ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#10 0xb6e261a5 in QSignal::signal () from /usr/share/qt3/lib/libqt-mt.so.3
#11 0xb6b23ca9 in QSignal::activate () from /usr/share/qt3/lib/libqt-mt.so.3
#12 0xb6b2ad71 in QSingleShotTimer::event ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#13 0xb6ab3370 in QApplication::internalNotify ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#14 0xb6ab29d4 in QApplication::notify () from /usr/share/qt3/lib/libqt-mt.so.3
#15 0xb70c1735 in KApplication::notify (this=0xbffff630, receiver=0x8258720, 
    event=0xbffff390) at kapplication.cpp:549
#16 0xb6aa3858 in QEventLoop::activateTimers ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#17 0xb6a5f95f in QEventLoop::processEvents ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#18 0xb6ac474c in QEventLoop::enterLoop ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#19 0xb6ac460e in QEventLoop::exec () from /usr/share/qt3/lib/libqt-mt.so.3
#20 0xb6ab357b in QApplication::exec () from /usr/share/qt3/lib/libqt-mt.so.3
#21 0x0804a3ea in main (argc=-4, argv=0xfffffffc) at main.cpp:252





Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
`system-supplied DSO at 0xffffe000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1237484992 (LWP 5515)]
[New Thread -1248080976 (LWP 5540)]
0xffffe410 in __kernel_vsyscall ()
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb683100e in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib/tls/i686/cmov/libpthread.so.0
#2  0xb6aa7d30 in QThread::wait () from /usr/share/qt3/lib/libqt-mt.so.3
#3  0xb7f2efbc in Digikam::ImageHistogram::stopCalcHistogramValues (
    this=0xfffffffc) at imagehistogram.cpp:91
#4  0xb7f2eedd in ~ImageHistogram (this=0x84ddb20) at imagehistogram.cpp:74
#5  0xb7f8215a in Canvas::updateHistogram (this=0x8474bc8) at canvas.cpp:457
#6  0xb7f81c51 in Canvas::load (this=0x8474bc8, filename=@0xfffffffc)
    at canvas.cpp:365
#7  0xb7f9489d in ImageWindow::slotLoadCurrent (this=0x84734d8) at kurl.h:361
#8  0xb7f9ac23 in ImageWindow::qt_invoke (this=0x84734d8, _id=72, 
    _o=0xbfffef30) at imagewindow.moc:213
#9  0xb6b0b067 in QObject::activate_signal ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#10 0xb6e261a5 in QSignal::signal () from /usr/share/qt3/lib/libqt-mt.so.3
#11 0xb6b23ca9 in QSignal::activate () from /usr/share/qt3/lib/libqt-mt.so.3
#12 0xb6b2ad71 in QSingleShotTimer::event ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#13 0xb6ab3370 in QApplication::internalNotify ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#14 0xb6ab29d4 in QApplication::notify () from /usr/share/qt3/lib/libqt-mt.so.3
#15 0xb70c1735 in KApplication::notify (this=0xbffff5e0, receiver=0x8258c58, 
    event=0xbffff340) at kapplication.cpp:549
#16 0xb6aa3858 in QEventLoop::activateTimers ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#17 0xb6a5f95f in QEventLoop::processEvents ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#18 0xb6ac474c in QEventLoop::enterLoop ()
   from /usr/share/qt3/lib/libqt-mt.so.3
#19 0xb6ac460e in QEventLoop::exec () from /usr/share/qt3/lib/libqt-mt.so.3
#20 0xb6ab357b in QApplication::exec () from /usr/share/qt3/lib/libqt-mt.so.3
#21 0x0804a3ea in main (argc=-4, argv=0xfffffffc) at main.cpp:252
Comment 3 Tom Albers 2005-08-07 23:28:54 UTC
Gilles, can you take a look at this when you get back?
Comment 4 caulier.gilles 2005-08-08 10:43:36 UTC
Blended histogram is displayed on imageeditor area during saving operations ?

Gilles
Comment 5 Owen Hirst 2005-08-09 19:33:05 UTC
Created attachment 12154 [details]
Patch to fix crash when histogram is visible

The histogram thread holds a pointer to the image data. Under certain
conditions, for eg, saving of image and reloading of image data, this image
data pointer is invalidated. Since the thread still holds a pointer to the
invalid pointer and tries to do calculations on it, the application crashes.
Attached patch deletes the histogram thread before reloading the image
Comment 6 caulier.gilles 2005-08-09 20:27:00 UTC
SVN commit 444324 by cgilles:

Patch from Owen Hirst to fix crash when histogram is visible.

The histogram thread holds a pointer to the image data. Under certain
conditions, for eg, saving of image and reloading of image data, this image
data pointer is invalidated. Since the thread still holds a pointer to the
invalid pointer and tries to do calculations on it, the application crashes.
Attached patch deletes the histogram thread before reloading the image

CCMAIL: digikam-devel@kde.org
CCBUGS: 109946



 M  +14 -7     canvas.cpp  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas.cpp #444323:444324
@@ -346,6 +346,12 @@
         emit signalSelected(false);
     }
 
+    if (d->imageHistogram)
+    {
+        delete d->imageHistogram;
+        d->imageHistogram = 0;
+    }    
+    
     viewport()->setUpdatesEnabled(false);
 
     d->tileCache.clear();
@@ -362,7 +368,7 @@
     viewport()->setUpdatesEnabled(true);
     viewport()->update();
     if (d->showHistogram)
-	    updateHistogram(true);
+       updateHistogram(true);
    
     emit signalChanged(false, false);
     emit signalZoomChanged(d->zoom);
@@ -453,11 +459,12 @@
  */
 bool Canvas::updateHistogram(bool invalidate)
 {
-    if (invalidate && d->imageHistogram) {
-	    delete d->imageHistogram;
-	    d->imageHistogram = 0;
+    if (invalidate && d->imageHistogram) 
+    {
+        delete d->imageHistogram;
+        d->imageHistogram = 0;
     }
-	
+
     if (d->imageHistogram == 0) {
         d->histogramReady = false;
         d->imageHistogram = new ImageHistogram(d->im->getData(),
@@ -710,9 +717,9 @@
 void Canvas::paintHistogram(const QRect& cr)
 {
     if (!d->showHistogram) 
-	    return;
+       return;
     if (!d->histogramPixmap)
-	    return;
+       return;
 
     QRect rcexposed, rc, rctmp;
 
Comment 7 caulier.gilles 2005-08-09 20:31:13 UTC
Patch apply on digiKam 0.8.0.

Tom, can you apply this patch on future digiKam 0.7.4 tarball ? Thanks in advance.

Gilles Caulier