Bug 382364

Summary: segfault after saying “no” to locale mismatch warning question
Product: [Applications] digikam Reporter: Thomas Debesse <dev>
Component: Database-ScanAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: caulier.gilles
Priority: NOR    
Version: 5.6.0   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed In: 5.8.0
Sentry Crash Report:

Description Thomas Debesse 2017-07-15 07:22:50 UTC
After being prompted for confirmation because of locale mismatch (see bug 382362) and cancelling, a segfaults occurs. I'm using digiKam 5.6.0 appimage build on Debian Stretch.

This is what the appimage build displays on console:

```
$ digikam-5.6.0-01-x86-64.appimage
-- digiKam AppImage Bundle
-- Use 'help' as CLI argument to know all available options
digikam.widgets: Breeze icons ressource file found
digikam.general: AlbumWatch use QFileSystemWatcher
digikam.general: Database Parameters:
   Type:                     "QMYSQL"
   DB Core Name:             "XXXXXXXXXXXXXXXXXXXXX"
   DB Thumbs Name:           "XXXXXXXXXXXXXXXXXXXXX"
   DB Face Name:             "XXXXXXXXXXXXXXXXXXXXX"
   Connect Options:          ""
   Host Name:                "XXXXXXXXXXXXXXXXXXXXX"
   Host port:                3306
   Internal Server:          false
   Internal Server Path:     ""
   Internal Server Serv Cmd: ""
   Internal Server Init Cmd: ""
   Username:                 "XXXXXXXXXXXXXXXXXXXXX"
   Password:                 "XXXXXXXXXXXXXXXXXXXXX"

digikam.dbengine: Loading SQL code from config file "/tmp/.mount_9UXxlv/usr/share/digikam/database/dbconfig.xml"
digikam.dbengine: Checking XML version ID => expected:  3  found:  3
digikam.coredb: Core database: running schema update
digikam.coredb: Core database: have a structure version  8
digikam.coredb: Core database: makeUpdates  8  to  8
digikam.database: Creating new Location  "/"  uuid  "networkshareid:?mountpath=//XXXXXXXXXXXXXXXXXXXXX"
digikam.database: location for  "//XXXXXXXXXXXXXXXXXXXXX"  is available  false
KMemoryInfo: Platform identified :  "LINUX"
KMemoryInfo: TotalRam:  8304119808
digikam.general: Allowing a cache size of 200 MB
/tmp/.mount_9UXxlv/AppRun: line 73:  4142 Segmentation fault      digikam.wrapper $@
```
Comment 1 caulier.gilles 2017-07-15 07:24:52 UTC
With AppImage, use a console and run with "debug" argument to use GDB and get a backtrace with 'bt' GDB command when issue occurs.
Comment 2 Thomas Debesse 2017-07-15 07:29:45 UTC
the backtrace:

```
[New Thread 0x7fffe5de9700 (LWP 4759)]
[Thread 0x7fffe5de9700 (LWP 4759) exited]
[Thread 0x7fffe65ea700 (LWP 4755) exited]

Thread 3 "Digikam::ScanCo" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe6deb700 (LWP 4754)]
0x00000034890a865e in QReadWriteLock::tryLockForWrite(int) () from /tmp/.mount_hsvVYv/usr/lib/libQt5Core.so.5
(gdb) thread apply all bt

Thread 3 (Thread 0x7fffe6deb700 (LWP 4754)):
#0  0x00000034890a865e in QReadWriteLock::tryLockForWrite(int) () from /tmp/.mount_hsvVYv/usr/lib/libQt5Core.so.5
#1  0x000000348dc20ddc in ?? () from /tmp/.mount_hsvVYv/usr/lib/libQt5Sql.so.5
#2  0x00007ffff65be954 in Digikam::DbEngineThreadData::closeDatabase (this=this@entry=0x7fffd810c560)
    at /b/dktemp/digikam-master/core/libs/database/engine/dbenginebackend.cpp:108
#3  0x00007ffff65bea8c in Digikam::DbEngineThreadData::~DbEngineThreadData (this=this@entry=0x7fffd810c560, __in_chrg=<optimized out>)
    at /b/dktemp/digikam-master/core/libs/database/engine/dbenginebackend.cpp:86
#4  0x00007ffff65c6abe in qThreadStorage_deleteData<Digikam::DbEngineThreadData> (d=0x7fffd810c560)
    at ././/include/QtCore/qthreadstorage.h:92
#5  QThreadStorage<Digikam::DbEngineThreadData*>::deleteData (x=0x7fffd810c560) at ././/include/QtCore/qthreadstorage.h:135
#6  0x00000034890ad502 in QThreadStorageData::finish(void**) () from /tmp/.mount_hsvVYv/usr/lib/libQt5Core.so.5
#7  0x00000034890ae14f in ?? () from /tmp/.mount_hsvVYv/usr/lib/libQt5Core.so.5
#8  0x00000034890aef51 in ?? () from /tmp/.mount_hsvVYv/usr/lib/libQt5Core.so.5
#9  0x00007ffff5f0e494 in start_thread (arg=0x7fffe6deb700) at pthread_create.c:333
#10 0x00007fffed90eaff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Thread 2 (Thread 0x7fffe86cf700 (LWP 4753)):
#0  0x00007fffed9056ad in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007fffecde3150 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007fffecde4ee9 in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007fffe8712aa9 in ?? () from /tmp/.mount_hsvVYv/usr/lib/libQt5XcbQpa.so.5
#4  0x00000034890aef49 in ?? () from /tmp/.mount_hsvVYv/usr/lib/libQt5Core.so.5
#5  0x00007ffff5f0e494 in start_thread (arg=0x7fffe86cf700) at pthread_create.c:333
#6  0x00007fffed90eaff in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Thread 1 (Thread 0x7ffff7dfe440 (LWP 4746)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000034890afaab in QWaitCondition::wait(QMutex*, unsigned long) () from /tmp/.mount_hsvVYv/usr/lib/libQt5Core.so.5
#2  0x00000034890aeb26 in QThread::wait(unsigned long) () from /tmp/.mount_hsvVYv/usr/lib/libQt5Core.so.5
#3  0x00007ffff74f7852 in Digikam::ScanController::shutDown (this=<optimized out>)
    at /b/dktemp/digikam-master/core/libs/database/utils/scancontroller.cpp:317
#4  0x00007ffff74fa406 in Digikam::ScanController::~ScanController (this=
    0x7ffff7dd75c0 <_ZZN7Digikam12_GLOBAL__N_113Q_QGS_creator13innerFunctionEvE6holder>, __in_chrg=<optimized out>)
    at /b/dktemp/digikam-master/core/libs/database/utils/scancontroller.cpp:293
#5  0x00007ffff74fa4c9 in Digikam::ScanControllerCreator::~ScanControllerCreator (this=<optimized out>, __in_chrg=<optimized out>)
    at /b/dktemp/digikam-master/core/libs/database/utils/scancontroller.cpp:233
#6  Digikam::(anonymous namespace)::Q_QGS_creator::Holder::~Holder (this=<optimized out>, __in_chrg=<optimized out>)
    at /b/dktemp/digikam-master/core/libs/database/utils/scancontroller.cpp:240
#7  0x00007fffed85b910 in __run_exit_handlers (status=0, listp=0x7fffedbbf5d8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, 
    run_dtors=run_dtors@entry=true) at exit.c:83
#8  0x00007fffed85b96a in __GI_exit (status=<optimized out>) at exit.c:105
#9  0x00007ffff7744435 in Digikam::AlbumManager::setDatabase (this=
    0x7ffff7dd8110 <_ZZN7Digikam12_GLOBAL__N_113Q_QGS_creator13innerFunctionEvE6holder>, params=..., priority=priority@entry=false, 
    suggestedAlbumRoot=...) at /b/dktemp/digikam-master/core/libs/album/albummanager.cpp:883
#10 0x000000000040589b in main (argc=1, argv=<optimized out>) at /b/dktemp/digikam-master/core/app/main/main.cpp:228
```
Comment 3 Maik Qualmann 2017-08-30 17:44:56 UTC
Git commit 1a396687af3ed8889e44e3fe1ac628d4893a7390 by Maik Qualmann.
Committed on 30/08/2017 at 17:43.
Pushed by mqualmann into branch 'master'.

fix crash after cancel the locale warning dialog
FIXED-IN: 5.8.0

M  +2    -1    NEWS
M  +8    -1    app/main/main.cpp
M  +1    -1    libs/album/albummanager.cpp

https://commits.kde.org/digikam/1a396687af3ed8889e44e3fe1ac628d4893a7390
Comment 4 Mohamed 2017-09-01 09:24:59 UTC
Git commit bb595216858426dde93af685a4b7f58f81963a84 by Mohamed Anwer, on behalf of Maik Qualmann.
Committed on 31/08/2017 at 17:35.
Pushed by mohamedanwer into branch 'gsoc17-healing'.

fix crash after cancel the locale warning dialog
FIXED-IN: 5.8.0

M  +2    -1    NEWS
M  +8    -1    app/main/main.cpp
M  +1    -1    libs/album/albummanager.cpp

https://commits.kde.org/digikam/bb595216858426dde93af685a4b7f58f81963a84
Comment 5 Mohamed 2017-09-01 09:49:31 UTC
Git commit a55f5291e75ac22e6e4185ef49be71cb5b44afe0 by Mohamed Anwer, on behalf of Maik Qualmann.
Committed on 01/09/2017 at 09:10.
Pushed by mohamedanwer into branch 'gsoc17-dlna'.

fix crash after cancel the locale warning dialog
FIXED-IN: 5.8.0

M  +2    -1    NEWS
M  +8    -1    app/main/main.cpp
M  +1    -1    libs/album/albummanager.cpp

https://commits.kde.org/digikam/a55f5291e75ac22e6e4185ef49be71cb5b44afe0