Bug 382649

Summary: Save As button freezes on second call
Product: [Applications] digikam Reporter: Mário Pereira <bin.to.hex+kde>
Component: ImageEditor-SaveAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED DOWNSTREAM    
Severity: major CC: freisim93
Priority: NOR    
Version: 5.6.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 7.5.0
Sentry Crash Report:

Description Mário Pereira 2017-07-24 09:17:57 UTC
When editing CR2 files, the Save As button works ok on the first image that I edit after opening digikam. When I go to edit the second CR2 file, when clicking Save As, the button stays pressed and digikam stops responding, requiring a force close.

The following is displayed in the console when saving the first image:
---

digikam.general: startSavingAs called

(digikam:18368): Gtk-CRITICAL **: gtk_file_chooser_default_set_current_name: assertion 'impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER' failed

(digikam:18368): GLib-GObject-WARNING **: cannot register existing type 'GdkWindow'

(digikam:18368): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(digikam:18368): GLib-GObject-CRITICAL **: g_type_register_static: assertion 'parent_type > 0' failed

(digikam:18368): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

---
After this, the Save As dialog appears and the file can be saved.
On the second call, only this is displayed in the console and digikam stops responding:
---

digikam.general: startSavingAs called

(digikam:18368): Gtk-CRITICAL **: gtk_file_chooser_default_set_current_name: assertion 'impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER' failed

---
This is pretty anoying, as it forces to close and re-open digikam after each file, not the ideal thing to do when you have 200 photos to process.
Comment 1 Simon 2017-07-24 09:57:44 UTC
In any case it would be helpful if you could run digiKam in gdb to produce a backtrace (https://www.digikam.org/contribute/).

This may still be related to
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=846630
Try running digiKam from command line with the following additional environment variable set:
QT_QPA_PLATFORMTHEME=gtk2 digikam
Comment 2 Mário Pereira 2017-07-24 10:21:52 UTC
I'm on Xubuntu 17.04.
The last comment from bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=846630 solved the problem.
After installing package qt5-style-plugins there were no more problems with the Save As button, it displayed the save dialog every time, even without the aditional environment variable.

FYI, here follows a stack trace after I was forced to ctrl-c into gdb when testing before installing the above package:

---

(digikam:23187): Gtk-CRITICAL **: gtk_file_chooser_default_set_current_name: assertion 'impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER' failed
[Thread 0x7ffec8bd0700 (LWP 23361) exited]
[Thread 0x7ffed1290700 (LWP 23276) exited]
[Thread 0x7ffeda3d9700 (LWP 23337) exited]
[Thread 0x7ffed2292700 (LWP 23274) exited]
[Thread 0x7ffec93d1700 (LWP 23360) exited]
[Thread 0x7ffed6b5d700 (LWP 23340) exited]
[Thread 0x7ffed735e700 (LWP 23339) exited]
[Thread 0x7ffebb8d7700 (LWP 23342) exited]
[Thread 0x7ffeeffff700 (LWP 23333) exited]
[Thread 0x7ffec2654700 (LWP 23287) exited]
[Thread 0x7ffed2a93700 (LWP 23270) exited]
[Thread 0x7ffed3294700 (LWP 23263) exited]
[Thread 0x7ffed3a95700 (LWP 23262) exited]
[Thread 0x7ffed4296700 (LWP 23261) exited]
[Thread 0x7fff0599f700 (LWP 23227) exited]
[Thread 0x7ffeba8d5700 (LWP 23346) exited]
[Thread 0x7ffec3656700 (LWP 23283) exited]
[Thread 0x7ffed8b61700 (LWP 23327) exited]
[Thread 0x7fff04a65700 (LWP 23231) exited]
[Thread 0x7ffed7b5f700 (LWP 23334) exited]
[Thread 0x7ffed8360700 (LWP 23329) exited]
[Thread 0x7ffed9bd8700 (LWP 23328) exited]
[Thread 0x7ffed0a8f700 (LWP 23281) exited]
[Thread 0x7ffec2e55700 (LWP 23286) exited]
[Thread 0x7ffed5282700 (LWP 23269) exited]
[Thread 0x7ffed028e700 (LWP 23282) exited]
[Thread 0x7ffed5a83700 (LWP 23268) exited]
[Thread 0x7ffed635c700 (LWP 23341) exited]
[Thread 0x7ffebb0d6700 (LWP 23345) exited]
[Thread 0x7ffeba0d4700 (LWP 23353) exited]
[Thread 0x7ffec1e53700 (LWP 23288) exited]
[Thread 0x7ffed1a91700 (LWP 23275) exited]


^C
Thread 1 "digikam" received signal SIGINT, Interrupt.
syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
38  ../sysdeps/unix/sysv/linux/x86_64/syscall.S: No such file or directory.
(gdb) bt
#0  0x00007ffff34e29f9 in syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1  0x00007fffe8e7803f in g_cond_wait () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fffe8e5a0e7 in g_once_init_enter () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007fffbaad5465 in gdk_x11_window_get_type () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0
#4  0x00007fffbb68c822 in  () at /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqgtk3.so
#5  0x00007fffbb68f394 in  () at /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqgtk3.so
#6  0x00007ffff525e310 in QDialogPrivate::setNativeDialogVisible(bool) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#7  0x00007ffff5270822 in QFileDialog::setVisible(bool) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#8  0x00007ffff525f241 in QDialog::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#9  0x00007ffff6966dcd in Digikam::EditorWindow::showFileSaveDialog(QUrl const&, QUrl&) ()
    at /usr/lib/digikam/libdigikamcore.so.5.6.0
#10 0x00007ffff6967609 in Digikam::EditorWindow::startingSaveAs(QUrl const&) ()
    at /usr/lib/digikam/libdigikamcore.so.5.6.0
#11 0x00007ffff774ecdf in  () at /usr/lib/digikam/libdigikamgui.so.5.6.0
#12 0x00007ffff69f769a in  () at /usr/lib/digikam/libdigikamcore.so.5.6.0
#13 0x00007ffff43c6789 in QMetaObject::activate(QObject*, int, int, void**) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007ffff506a992 in QAction::triggered(bool) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
---Type <return> to continue, or q <return> to quit---
#15 0x00007ffff506d380 in QAction::activate(QAction::ActionEvent) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff515ab2d in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff515ad64 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#18 0x00007ffff5226fca in QToolButton::mouseReleaseEvent(QMouseEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007ffff50b8918 in QWidget::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#20 0x00007ffff52270a9 in QToolButton::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#21 0x00007ffff507135c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#22 0x00007ffff50799dd in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#23 0x00007ffff439ac00 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#24 0x00007ffff507808d in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#25 0x00007ffff50d2e16 in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#26 0x00007ffff50d57f3 in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#27 0x00007ffff507135c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
---Type <return> to continue, or q <return> to quit---
#28 0x00007ffff5078b21 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#29 0x00007ffff439ac00 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#30 0x00007ffff48de723 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#31 0x00007ffff48e0295 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#32 0x00007ffff48be22b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#33 0x00007fffbd3946d0 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#34 0x00007fffe8e32377 in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007fffe8e325e0 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007fffe8e3268c in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#37 0x00007ffff43ef09f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#38 0x00007ffff4398bea in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#39 0x00007ffff43a133c in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#40 0x0000555555559d5d in  ()
---Type <return> to continue, or q <return> to quit---
#41 0x00007ffff34003f1 in __libc_start_main (main=
    0x555555558ec0, argc=1, argv=0x7fffffffde68, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffde58) at ../csu/libc-start.c:291
#42 0x000055555555b12a in _start ()
Comment 3 Simon 2017-07-24 11:40:37 UTC
@Mário Pereira
Did you only install qt5-style-plugins or also set QT_QPA_PLATFORMTHEME=gtk2?

@Maik and Gilles:

While the problem itself could probably be solved in packaging I am still wondering why native (i.e. GTK) dialogs/styles come into play. The relevant dialog is imageFileSaveDialog in editorwindow.cpp which is a DFileDialog. In its initialization
    setOption(QFileDialog::DontUseNativeDialog);
is run. So as far as I understand the dialog should be QT and nothing native, however this report shows that this is not the case.
Comment 4 Mário Pereira 2017-07-24 12:48:46 UTC
@Simon, just installing qt5-style-plugins solved the problem. I'm using the launcher that I had before upgrading digikam and it works nicely again after installing the package. FYI, I was using digikam 5.4 on Xubuntu 16.10, then upgraded to Xubuntu 17.04 and digikam 5.5, noticed the problem and upgraded to digikam 5.6 to see if it solved it. That was when I reported the bug. Now I have 5.6 working nicely in 17.04.

Thanks for the support
Comment 5 Simon 2017-07-24 13:04:12 UTC
Where do you install digiKam from? You should file a bug request with your packager asking to depend on this package.
Comment 6 Mário Pereira 2017-07-24 13:09:56 UTC
5.5 was installed from the Ubuntu repositories, upgraded when I upgraded to 17.04.
5.6 was installed from https://launchpad.net/~philip5/+archive/ubuntu/extra

I'll file a bug with both, thanks