Bug 505103

Summary: Digikam git freeze when trying to drag and drop/copy files/images inside albums (Wayland/Hyprland)
Product: [Applications] digikam Reporter: maderios <leoutation>
Component: Albums-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin, nonobio
Priority: NOR    
Version First Reported In: 8.7.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 8.8.0
Sentry Crash Report:
Attachments: Clang scan reports tarball from 9/8/2025

Description maderios 2025-06-01 19:59:53 UTC
Digikam git freezes (exactly when i click on 'copy here/move here' when mouse is over destination album) when I try to move files from album to another one (only wayland env), 
 I have to kill window.
No debug trace about this issue
Other QT6 applications like pcmanfm-qt work normally
Conditions:
digikam git QT6 
Wayland environment (Hyprland)
qt6  6.9.0-2 
qt6-wayland 6.9.0-2
wayland 1.23.1-2
xorg-xwayland 24.1.6-1
hyprland 0.49.0-1
Arch system
Mysql external server
Comment 1 Maik Qualmann 2025-06-01 20:17:55 UTC
Can't reproduce this issue here under openSUSE Tumbleweed and Wayland. Does it also freeze when you select "Cancel" from the popup menu?

Maik
Comment 2 maderios 2025-06-02 09:04:28 UTC
It freezes whole desktop as soon as popup appears over destination album, so i can't click. Desktop is back after killing  Digikam window with keyboard shortcut.
Comment 3 Maik Qualmann 2025-06-02 19:47:41 UTC
Okay, there's some kind of problem with QMenu, which provides the popup. We have a bug report on Windows (Bug 501862) that says the popup doesn't appear at all for some users, and the first entry is always automatically selected. However, I can't reproduce the problem myself on three computers (Win 10/11) on Windows. There are indications in the Qt bug tracker that a change was made in Qt-6.8.x that is causing the problem. I think for now we'll just have to wait and see if the problem is fixed on the Qt side.

Maik
Comment 4 maderios 2025-06-03 12:28:26 UTC
Same issue with Digikam/QT5. Problem is not present when using Sway. It seems it's Hyprland bug, i have to report it  upstream.
Comment 5 maderios 2025-06-03 12:45:49 UTC
I reported here
https://github.com/hyprwm/Hyprland/issues/10633
Comment 6 maderios 2025-06-03 12:54:13 UTC
Only discussion here
https://github.com/hyprwm/Hyprland/discussions/10634
Comment 7 Maik Qualmann 2025-06-05 20:03:03 UTC
Git commit 4d25dd4f1ef3a340028910b23d50ff3db6eb83b5 by Maik Qualmann.
Committed on 05/06/2025 at 20:01.
Pushed by mqualmann into branch 'master'.

use the active window as parent for the QMenu
Related: bug 501862

M  +5    -5    core/app/dragdrop/albumdragdrop.cpp
M  +2    -2    core/app/dragdrop/importdragdrop.cpp
M  +4    -4    core/app/dragdrop/itemdragdrop.cpp
M  +4    -4    core/app/dragdrop/tagdragdrop.cpp

https://invent.kde.org/graphics/digikam/-/commit/4d25dd4f1ef3a340028910b23d50ff3db6eb83b5
Comment 8 maderios 2025-06-06 09:57:45 UTC
Git commit 4d25dd4f1ef3a340028910b23d50ff3db6eb83b5 doesn't solve issue.   
More precisions:  I can restore desktop using escape key.  I can't drag and drop images from album to another one with mouse but i can do it with right click function "move to album". I can't move album/folder to another one with mouse: "move here" "copy here" "cancel" are frozen, like for images
Comment 9 maderios 2025-07-18 13:48:42 UTC
Maybe useful : I discover freeze issue happens when using confirmation/choice box (no way to disable it now) that appears when I want to drag & drop files inside Digikam window. There is no DND problem when i drag and drop files from Digikam window to "Digikam batch queue manager" which is separate window beside Digikam window. This "Batch queue manager" doesn't ask me any confirmation/choice, that's why it works fine with Hyprland I think.
Comment 10 maderios 2025-08-05 19:00:33 UTC
Issue is still there, I'm wondering why it only happens with Digikam. I tested Dolphin with Hyprland. Moving files from directory to another one  works  fine. 
I recently discovered  I can silently drag/copy/drop a file with CTRL+LEFT click (but not move) successfully inside Digikam. No confirmation is asked. This behaviour confirms, maybe,  drag/drop issue is related to specific Digikam dialog/choice/confirmation box.
Comment 11 caulier.gilles 2025-08-05 19:09:09 UTC
try the digikam 8.8.0 prerelease AppImage. I upgraded Qt to 6.9.1:

https://files.kde.org/digikam/
Comment 12 maderios 2025-08-05 19:58:42 UTC
- Digikam version I use is git version already built with  with QT 6.9.1
-  I just tested  last Appimage from your link , it works very badly with Hyprland, far worth than my git version. Unable even to copy file with CTRL+LEFT click. Clicking on thumbnail does nothing.
Comment 13 maderios 2025-08-05 20:02:55 UTC
(In reply to maderios from comment #12)
> - Digikam version I use is git version already built with  with QT 6.9.1
> -  I just tested  last Appimage from your link , it works very badly with
> Hyprland, far worth than my git version. Unable even to copy file with
> CTRL+LEFT click. Clicking on thumbnail does nothing.

Correction : Clicking on thumbnail displays image but doesnt do anything  about moving/copying.
Comment 14 caulier.gilles 2025-08-09 06:56:46 UTC
Maik,

About the drag and drop issue with Qt6, Clang scan-build report 3 issues in the relevant code:

Logic error	Called C++ object pointer is null	app/dragdrop/itemdragdrop.cpp	s_groupAction	269	38	Called C++ object pointer is null	View Report
Logic error	Called C++ object pointer is null	app/dragdrop/itemdragdrop.cpp	tagAction	221	38	Called C++ object pointer is null	View Report
Logic error	Called C++ object pointer is null	app/dragdrop/itemdragdrop.cpp	copyOrMove	172	34	Called C++ object pointer is null	View Report

I'm not sure if it's the problem as the hierarchy of calls are complex to follow in the reports

I will attach the report tarball here...

Best

Gilles
Comment 15 caulier.gilles 2025-08-09 06:59:19 UTC
Created attachment 183900 [details]
Clang scan reports tarball from 9/8/2025
Comment 16 Maik Qualmann 2025-08-09 08:56:27 UTC
Yes, Clang "thinks" because we do a dynamic_cast of "view" and check it, that "view" could also be null, but that is never the case.

Maik
Comment 17 maderios 2025-08-10 09:35:56 UTC
My Clang version is 20.1.8-1 (Arch system)
Comment 18 nonobio 2025-09-12 15:26:25 UTC
Hi,
I just saw the problem by drag and drop, as I often do, from photos to another album. Usually a menu to choose to copy or move appears, but there I don't have a menu.
I have Digikam 8.7.0 and Windows 11.
Thanks
Comment 19 Maik Qualmann 2025-09-17 18:13:35 UTC
Git commit ac70e90408be4b5b63c667f8d51e79af3a99c4ef by Maik Qualmann.
Committed on 17/09/2025 at 18:12.
Pushed by mqualmann into branch 'master'.

try an ugly thing to fix the QMenu problem
Related: bug 501862

M  +10   -5    core/app/dragdrop/albumdragdrop.cpp
M  +10   -5    core/app/dragdrop/itemdragdrop.cpp
M  +8    -4    core/app/dragdrop/tagdragdrop.cpp

https://invent.kde.org/graphics/digikam/-/commit/ac70e90408be4b5b63c667f8d51e79af3a99c4ef
Comment 20 maderios 2025-09-18 12:19:07 UTC
Bug is still present after rebuilding with patch. It's real dialog issue because I can  drag an drop silently files to folders with select image/left click+shift and/or copy silently with select image/left click+ctrl
Comment 21 Maik Qualmann 2025-09-18 19:33:23 UTC
Git commit 0e02bf49d6ed0c0f0cbac65f9c679b3cd059e8fd by Maik Qualmann.
Committed on 18/09/2025 at 19:32.
Pushed by mqualmann into branch 'master'.

next try to fix the QMenu problem
Related: bug 501862

M  +6    -5    core/app/dragdrop/albumdragdrop.cpp
M  +5    -4    core/app/dragdrop/itemdragdrop.cpp
M  +5    -4    core/app/dragdrop/tagdragdrop.cpp
M  +26   -0    core/app/utils/digikam_globals.cpp
M  +8    -0    core/app/utils/digikam_globals.h
M  +2    -0    core/app/utils/digikam_globals_p.h

https://invent.kde.org/graphics/digikam/-/commit/0e02bf49d6ed0c0f0cbac65f9c679b3cd059e8fd
Comment 22 maderios 2025-09-19 14:56:08 UTC
Rebuilding, no change, issue still happens
Comment 23 Maik Qualmann 2025-09-19 20:04:24 UTC
Git commit 991aa07160afa1662ab572647fb30c24b4f0d0ef by Maik Qualmann.
Committed on 19/09/2025 at 20:03.
Pushed by mqualmann into branch 'master'.

disable mouse tracking over popup menu
Related: bug 501862

M  +0    -10   core/app/dragdrop/albumdragdrop.cpp
M  +0    -5    core/app/dragdrop/importdragdrop.cpp
M  +0    -17   core/app/dragdrop/itemdragdrop.cpp
M  +0    -11   core/app/dragdrop/tagdragdrop.cpp

https://invent.kde.org/graphics/digikam/-/commit/991aa07160afa1662ab572647fb30c24b4f0d0ef
Comment 24 Maik Qualmann 2025-09-21 08:34:34 UTC
Git commit 54a5aea116901dd52959d15e761d3f679599e2d2 by Maik Qualmann.
Committed on 21/09/2025 at 08:33.
Pushed by mqualmann into branch 'master'.

fix QMenu in tag drag and drop
Item and album drag and drop to come...
Related: bug 501862

M  +321  -357  core/app/dragdrop/tagdragdrop.cpp
M  +18   -0    core/app/dragdrop/tagdragdrop.h

https://invent.kde.org/graphics/digikam/-/commit/54a5aea116901dd52959d15e761d3f679599e2d2
Comment 25 Maik Qualmann 2025-09-21 10:08:21 UTC
Git commit b6b0576196f0a9323a33997837df4fba8901cf60 by Maik Qualmann.
Committed on 21/09/2025 at 10:07.
Pushed by mqualmann into branch 'master'.

fix QMenu in album drag and drop
Related: bug 501862

M  +255  -304  core/app/dragdrop/albumdragdrop.cpp
M  +20   -0    core/app/dragdrop/albumdragdrop.h
M  +3    -1    core/app/dragdrop/tagdragdrop.cpp

https://invent.kde.org/graphics/digikam/-/commit/b6b0576196f0a9323a33997837df4fba8901cf60
Comment 26 Maik Qualmann 2025-09-21 14:44:52 UTC
Git commit df78c22e0951c7622bffa76f2a6e2cfbe4a2b9ab by Maik Qualmann.
Committed on 21/09/2025 at 14:44.
Pushed by mqualmann into branch 'master'.

fix QMenu in item drag and drop
Related: bug 501862

M  +2    -1    core/app/dragdrop/albumdragdrop.cpp
M  +519  -561  core/app/dragdrop/itemdragdrop.cpp
M  +42   -1    core/app/dragdrop/itemdragdrop.h
M  +2    -2    core/app/dragdrop/tagdragdrop.cpp

https://invent.kde.org/graphics/digikam/-/commit/df78c22e0951c7622bffa76f2a6e2cfbe4a2b9ab
Comment 27 Maik Qualmann 2025-09-21 15:22:00 UTC
Git commit be271a6188aa89492a035a461cc45867ad2ebe5e by Maik Qualmann.
Committed on 21/09/2025 at 15:21.
Pushed by mqualmann into branch 'master'.

fix QMenu in import drag and drop
Related: bug 501862

M  +38   -147  core/app/dragdrop/importdragdrop.cpp
M  +6    -15   core/app/dragdrop/importdragdrop.h
M  +1    -0    core/app/dragdrop/itemdragdrop.cpp
M  +2    -0    core/app/dragdrop/itemdragdrop.h

https://invent.kde.org/graphics/digikam/-/commit/be271a6188aa89492a035a461cc45867ad2ebe5e
Comment 28 Maik Qualmann 2025-09-21 15:40:57 UTC
I was able to reproduce this under Wayland here, where the menus worked when clicked, but weren't "active." There was no highlighting over the QActions like under X11.
It seems that a QMenu shouldn't be called within the QDropEvent event.
I hope this issue is now resolved and I didn't make any mistakes during the porting.

Maik
Comment 29 maderios 2025-09-21 18:51:03 UTC
I get build error  

[ 55%] [32mBuilding CXX object core/app/CMakeFiles/gui_digikam_obj.dir/views/utils/componentsinfodlg.cpp.o[0m
[ 55%] [32mBuilding CXX object core/app/CMakeFiles/gui_digikam_obj.dir/digikamadaptor.cpp.o[0m
[ 55%] [32mBuilding CXX object core/libs/dimg/CMakeFiles/core_dimg_obj.dir/history/filteraction.cpp.o[0m
[ 55%] Built target core_digikamwidgets_obj
[ 55%] [32mBuilding CXX object core/libs/dimg/CMakeFiles/core_dimg_obj.dir/history/historyimageid.cpp.o[0m
/home/fre/ARCH-AUR/digikam-git-qt6/src/digikam/core/libs/dimg/filters/sharp/sharpsettings.cpp: In constructor ‘Digikam::SharpSettings::SharpSettings(QWidget*)’:
/home/fre/ARCH-AUR/digikam-git-qt6/src/digikam/core/libs/dimg/filters/sharp/sharpsettings.cpp:107:31: error: ‘layoutSpacing’ was not declared in this scope
  107 |     const int spacing       = layoutSpacing();
      |                               ^~~~~~~~~~~~~
make[2]: *** [core/libs/dimg/CMakeFiles/core_dimg_obj.dir/build.make:1219: core/libs/dimg/CMakeFiles/core_dimg_obj.dir/filters/sharp/sharpsettings.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:6875: core/libs/dimg/CMakeFiles/core_dimg_obj.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 55%] Built target gui_digikam_obj
make: *** [Makefile:136: all] Error
Comment 30 Maik Qualmann 2025-09-21 18:57:26 UTC
The compile error isn't related to my current changes. Check that you're actually on git/master and recreate the build directory.
Our automatic git CI job build also without problems.

Maik
Comment 31 Maik Qualmann 2025-09-21 19:02:39 UTC
Please try again with my last commit to git/master.

Maik
Comment 32 maderios 2025-09-21 19:27:50 UTC
It builds fine now, drag and drop issue is solved. Great !
Comment 33 Maik Qualmann 2025-09-21 19:53:12 UTC
Thanks for the feedback. I think this also solves the QMenu issue on some Windows computers.

Maik
Comment 34 nonobio 2025-09-22 06:11:55 UTC
I installed digiKam-8.8.0-20250922T050143-Qt6-Win64.exe and the issue is fixed! thanks a lot :)