Bug 345168 - Crash when applying auto lens correction (chromatic aberration) [patch]
Summary: Crash when applying auto lens correction (chromatic aberration) [patch]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Unclassified
Component: Plugin-Editor-LensCorrection (show other bugs)
Version: 4.8.0
Platform: openSUSE RPMs Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2015-03-15 07:56 UTC by C. Priisholm
Modified: 2016-07-01 09:22 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.0


Attachments
getsubpixelcolorfast.patch (449 bytes, patch)
2015-03-15 21:49 UTC, Maik Qualmann
Details
getsubpixelcolorfast2.patch (1.10 KB, patch)
2015-03-16 19:49 UTC, Maik Qualmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description C. Priisholm 2015-03-15 07:56:43 UTC
Application: digikam (4.8.0)
KDE Platform Version: 4.14.6
Qt Version: 4.8.6
Operating System: Linux 3.19.1-1-desktop x86_64
Distribution: "openSUSE 20150312 (Tumbleweed) (x86_64)"

-- Information about the crash:
Opened a raw (Sony ARW file) in the editor, applied default raw import options.
Selected auto correction tool. All correction option set (default settings).
Preview looks fine, then clicked OK which causes the application to crash.
This happens every time for the test image.
In the possibly related bug report a comment suggested that disabling the chromatic aberration correction makes a difference, and I can confirm it it does.
If the chromatic aberration checkmark is not set, then the correction procedure works (without the c.a. correction of course).

The crash can be reproduced every time.

-- Backtrace:
Application: digiKam (digikam), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f3b492b9880 (LWP 5016))]

Thread 5 (Thread 0x7f3b29bc4700 (LWP 5017)):
#0  0x00007f3b41d8cea2 in __libc_disable_asynccancel () from /lib64/libc.so.6
#1  0x00007f3b41d784d9 in poll () from /lib64/libc.so.6
#2  0x00007f3b2a545268 in ?? () from /usr/lib64/libusb-1.0.so.0
#3  0x00007f3b3f9214b4 in start_thread () from /lib64/libpthread.so.0
#4  0x00007f3b41d80a4d in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7f3b230f8700 (LWP 5018)):
#0  0x00007f3b3f92594f in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f3b42857066 in wait (time=18446744073709551615, this=0x2e24f60) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=this@entry=0x2e5eae0, mutex=mutex@entry=0x2e5ead8, time=time@entry=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00000000005e3d5e in Digikam::ScanController::run (this=0x2e24d00) at /usr/src/debug/digikam-4.8.0/core/app/database/scancontroller.cpp:725
#4  0x00007f3b42856b7f in QThreadPrivate::start (arg=0x2e24d00) at thread/qthread_unix.cpp:349
#5  0x00007f3b3f9214b4 in start_thread () from /lib64/libpthread.so.0
#6  0x00007f3b41d80a4d in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7f3b228f7700 (LWP 5019)):
#0  0x00007f3b39ec166c in g_main_context_check () from /usr/lib64/libglib-2.0.so.0
#1  0x00007f3b39ec1b7b in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x00007f3b39ec1cec in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f3b4298501e in QEventDispatcherGlib::processEvents (this=0x7f3b140008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:452
#4  0x00007f3b42956daf in QEventLoop::processEvents (this=this@entry=0x7f3b228f6d20, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007f3b429570a5 in QEventLoop::exec (this=this@entry=0x7f3b228f6d20, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007f3b4285449f in QThread::exec (this=this@entry=0x2e5dcb0) at thread/qthread.cpp:538
#7  0x00007f3b429386b3 in QInotifyFileSystemWatcherEngine::run (this=0x2e5dcb0) at io/qfilesystemwatcher_inotify.cpp:265
#8  0x00007f3b42856b7f in QThreadPrivate::start (arg=0x2e5dcb0) at thread/qthread_unix.cpp:349
#9  0x00007f3b3f9214b4 in start_thread () from /lib64/libpthread.so.0
#10 0x00007f3b41d80a4d in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f3b05ffb700 (LWP 5138)):
[KCrash Handler]
#5  setColor (sixteenBit=false, data=0x7f3bb758ba28 <error: Cannot access memory at address 0x7f3bb758ba28>, this=<synthetic pointer>) at /usr/src/debug/digikam-4.8.0/core/libs/dimg/dcolorpixelaccess.h:42
#6  Digikam::DImg::getSubPixelColorFast (this=this@entry=0x8406888, x=<optimized out>, y=<optimized out>) at /usr/src/debug/digikam-4.8.0/core/libs/dimg/dimg.cpp:1400
#7  0x00007f3b4704a6a1 in Digikam::LensFunFilter::filterImage (this=0x8406840) at /usr/src/debug/digikam-4.8.0/core/libs/dimg/filters/lens/lensfunfilter.cpp:189
#8  0x00007f3b46f2a5b9 in Digikam::DImgThreadedFilter::startFilterDirectly (this=0x8406840) at /usr/src/debug/digikam-4.8.0/core/libs/dimg/filters/dimgthreadedfilter.cpp:197
#9  0x00007f3b470d5d3e in Digikam::DynamicThread::DynamicThreadPriv::run (this=0x80efea0) at /usr/src/debug/digikam-4.8.0/core/libs/threads/dynamicthread.cpp:186
#10 0x00007f3b4284aa8e in QThreadPoolThread::run (this=0x4ff3570) at concurrent/qthreadpool.cpp:108
#11 0x00007f3b42856b7f in QThreadPrivate::start (arg=0x4ff3570) at thread/qthread_unix.cpp:349
#12 0x00007f3b3f9214b4 in start_thread () from /lib64/libpthread.so.0
#13 0x00007f3b41d80a4d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f3b492b9880 (LWP 5016)):
#0  0x00007f3b3f92594f in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007f3b42857066 in wait (time=18446744073709551615, this=0x2fd1a50) at thread/qwaitcondition_unix.cpp:86
#2  QWaitCondition::wait (this=this@entry=0x2eb31a0, mutex=mutex@entry=0x2eb3178, time=time@entry=18446744073709551615) at thread/qwaitcondition_unix.cpp:158
#3  0x00007f3b42849cf2 in QThreadPoolPrivate::waitForDone (this=0x2eb30f0, msecs=msecs@entry=-1) at concurrent/qthreadpool.cpp:295
#4  0x00007f3b4284b155 in QThreadPool::~QThreadPool (this=0x2eb2df0, __in_chrg=<optimized out>) at concurrent/qthreadpool.cpp:438
#5  0x00007f3b4284b189 in QThreadPool::~QThreadPool (this=0x2eb2df0, __in_chrg=<optimized out>) at concurrent/qthreadpool.cpp:440
#6  0x00007f3b4296ea28 in QObjectPrivate::deleteChildren (this=this@entry=0x2eb4680) at kernel/qobject.cpp:1944
#7  0x00007f3b42970fbf in QObject::~QObject (this=0x2fa2970, __in_chrg=<optimized out>) at kernel/qobject.cpp:954
#8  0x00007f3b470d2ec7 in ~ThreadManagerCreator (this=0x2fa2970, __in_chrg=<optimized out>) at /usr/src/debug/digikam-4.8.0/core/libs/threads/threadmanager.cpp:236
#9  destroy () at /usr/src/debug/digikam-4.8.0/core/libs/threads/threadmanager.cpp:241
#10 0x00007f3b41ccfc39 in __run_exit_handlers () from /lib64/libc.so.6
#11 0x00007f3b41ccfc85 in exit () from /lib64/libc.so.6
#12 0x00007f3b433cd078 in ?? () from /usr/lib64/libQtGui.so.4
#13 0x00007f3b4407d890 in KApplication::xioErrhandler(_XDisplay*) () from /usr/lib64/libkdeui.so.5
#14 0x00007f3b3e39b39e in _XIOError () from /usr/lib64/libX11.so.6
#15 0x00007f3b3e39951a in _XReply () from /usr/lib64/libX11.so.6
#16 0x00007f3b3e394e6d in XSync () from /usr/lib64/libX11.so.6
#17 0x00007f3b43555055 in QRasterWindowSurface::syncX() () from /usr/lib64/libQtGui.so.4
#18 0x00007f3b43555335 in QRasterWindowSurface::beginPaint(QRegion const&) () from /usr/lib64/libQtGui.so.4
#19 0x00007f3b4356eb6f in ?? () from /usr/lib64/libQtGui.so.4
#20 0x00007f3b433a5660 in QWidgetPrivate::syncBackingStore() () from /usr/lib64/libQtGui.so.4
#21 0x00007f3b433b560a in QWidget::event(QEvent*) () from /usr/lib64/libQtGui.so.4
#22 0x00007f3b4376b3b3 in QMainWindow::event(QEvent*) () from /usr/lib64/libQtGui.so.4
#23 0x00007f3b4416a549 in KXmlGuiWindow::event(QEvent*) () from /usr/lib64/libkdeui.so.5
#24 0x00007f3b4336680c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#25 0x00007f3b4336cd4d in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#26 0x00007f3b4407ecda in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#27 0x00007f3b429581ed in QCoreApplication::notifyInternal (this=0x7ffc0673f0d0, receiver=receiver@entry=0x5f1cc80, event=event@entry=0x62556c0) at kernel/qcoreapplication.cpp:953
#28 0x00007f3b4295b4bd in sendEvent (event=0x62556c0, receiver=0x5f1cc80) at kernel/qcoreapplication.h:231
#29 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x2bb7520) at kernel/qcoreapplication.cpp:1577
#30 0x00007f3b4295b963 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1470
#31 0x00007f3b4298583e in sendPostedEvents () at kernel/qcoreapplication.h:236
#32 postEventSourceDispatch (s=0x2c65e60) at kernel/qeventdispatcher_glib.cpp:300
#33 0x00007f3b39ec1a04 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#34 0x00007f3b39ec1c48 in ?? () from /usr/lib64/libglib-2.0.so.0
#35 0x00007f3b39ec1cec in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#36 0x00007f3b42984ffe in QEventDispatcherGlib::processEvents (this=0x2bbcdd0, flags=...) at kernel/qeventdispatcher_glib.cpp:450
#37 0x00007f3b43403706 in ?? () from /usr/lib64/libQtGui.so.4
#38 0x00007f3b42956daf in QEventLoop::processEvents (this=this@entry=0x7ffc0673ebb0, flags=...) at kernel/qeventloop.cpp:149
#39 0x00007f3b429570a5 in QEventLoop::exec (this=this@entry=0x7ffc0673ebb0, flags=...) at kernel/qeventloop.cpp:204
#40 0x00007f3b4295c4f9 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225
#41 0x00000000004a0c50 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/digikam-4.8.0/core/app/main/main.cpp:237

The reporter indicates this bug may be a duplicate of or related to bug 319383.

Possible duplicates by query: bug 333523.

Reported using DrKonqi
Comment 1 C. Priisholm 2015-03-15 08:25:24 UTC
Here is the raw file causes the crash: 
http://www.codedroids.dk/pub/DSC01972.ARW
In terms of the lens info that one is shot with SONY / ILCE-5000 / E PZ 16-50mm F3.5-5.6 OSS
I've provided two other images, shot with different lenses. In both cases I can apply the lens correction - incl. chromatic aberration - without crashing digiKam:
http://www.codedroids.dk/pub/DSC01754.ARW - SONY / ILCE-5000 / E 30mm F2.8
and
http://www.codedroids.dk/pub/DSC01925.ARW - SONY / ILCE-5000 / E 55-210mm F4.5-6.3 OSS

So it does seem the problem is limited to certain lenses
Comment 2 Maik Qualmann 2015-03-15 08:44:41 UTC
If the test images already uploaded? I get a file not found error.

Maik
Comment 3 C. Priisholm 2015-03-15 08:52:18 UTC
Sorry, they were in the wrong folder - please try again.
Comment 4 Maik Qualmann 2015-03-15 10:15:18 UTC
Yes with the image DSC01972.ARW crashes the lenses correction...
Comment 5 caulier.gilles 2015-03-15 10:20:12 UTC
RAW image is open in 16 bits color depth or 8 bits ? There is a difference between import mode ?

As backtrace said, perhaps there is a problem while pixels processing.

Gilles
Comment 6 caulier.gilles 2015-03-15 10:21:17 UTC
Another possible cause, the pixels image size is not well taken from this RAW image metadata.

Gilles
Comment 7 Maik Qualmann 2015-03-15 21:49:14 UTC
Created attachment 91573 [details]
getsubpixelcolorfast.patch

Coordinates of lfModifier ::ApplySubpixelDistortion(...) can be negative. It must be caught in DImg::getSubPixelColorFast(...).
Comment 8 caulier.gilles 2015-03-15 22:26:41 UTC
Git commit a0ea63613faf5062e6891eb12d53b334b1babc4a by Gilles Caulier.
Committed on 15/03/2015 at 23:21.
Pushed by cgilles into branch 'master'.

Apply patch # 91573 from Maik Qualmann to wrap image pixel positions to image sizes when Lens Corrections are applied by LensFun.
Related: bug 333540, bug 319383
FIXED-IN: 4.9.0

M  +4    -1    NEWS
M  +22   -13   libs/dimg/dimg.cpp

http://commits.kde.org/digikam/a0ea63613faf5062e6891eb12d53b334b1babc4a
Comment 9 caulier.gilles 2015-03-15 22:49:09 UTC
Git commit 53fd2de987febf552103de3ecc910a4d9c94c0d2 by Gilles Caulier.
Committed on 15/03/2015 at 22:47.
Pushed by cgilles into branch 'frameworks'.

backport commit #a0ea63613faf5062e6891eb12d53b334b1babc4a from git/master to frameworks branch
Related: bug 333540, bug 319383

M  +16   -7    libs/dimg/dimg.cpp

http://commits.kde.org/digikam/53fd2de987febf552103de3ecc910a4d9c94c0d2
Comment 10 Maik Qualmann 2015-03-16 19:49:20 UTC
Created attachment 91583 [details]
getsubpixelcolorfast2.patch

I think with this patch it is perfect.

Maik
Comment 11 caulier.gilles 2015-03-16 22:20:02 UTC
Git commit 2a0a710fb2b92a0b6115f329799a40a9dec8aeb9 by Gilles Caulier.
Committed on 16/03/2015 at 22:19.
Pushed by cgilles into branch 'master'.

apply patch #91583 from MAik Qualmann

M  +8    -7    libs/dimg/dimg.cpp

http://commits.kde.org/digikam/2a0a710fb2b92a0b6115f329799a40a9dec8aeb9
Comment 12 caulier.gilles 2015-03-16 22:28:05 UTC
Git commit 6713c4088e19bacbf990992be2c2bd98b5aa03eb by Gilles Caulier.
Committed on 16/03/2015 at 22:27.
Pushed by cgilles into branch 'frameworks'.

backport commit #2a0a710fb2b92a0b6115f329799a40a9dec8aeb9 from git/master

M  +8    -7    libs/dimg/dimg.cpp

http://commits.kde.org/digikam/6713c4088e19bacbf990992be2c2bd98b5aa03eb