Bug 485194

Summary: Choose a folder from file dialog will leads to `kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected" "Not connected to D-Bus server"`
Product: [Plasma] xdg-desktop-portal-kde Reporter: shenlebantongying <shenlebantongying>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: CONFIRMED ---    
Severity: normal CC: aleixpol, jgrulich, kdedev, nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description shenlebantongying 2024-04-07 18:49:12 UTC
SUMMARY

Choose a folder will lead to crash.

Previously https://github.com/xiaoyifang/goldendict-ng/issues/1465

Not sure exactly what's changed, but this only happens recently. Reproducible on at least two distinct machines, my (arch) and the OP of the issue above (debian) .

STEPS TO REPRODUCE
1. Install this app https://flathub.org/apps/io.github.xiaoyifang.goldendict_ng
2. Click edit-> dictionaries-> add -> select any folder -> press enter.

OBSERVED RESULT

Crash with this message.
```
kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected"
"Not connected to D-Bus server"
kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected"
"Not connected to D-Bus server"
kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected"
"Not connected to D-Bus server"
```

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.3
Kernel Version: 6.8.4-arch1-1 (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION

The same operation doesn't crash on GNOME/Sway meanwhile.

I do ensured that the service is running.

````
$ systemctl --user status xdg-desktop-portal.service
● xdg-desktop-portal.service - Portal service
Loaded: loaded (/usr/lib/systemd/user/xdg-desktop-portal.service; static)
Active: active (running) since Sun 2024-04-07 14:45:29 EDT; 2min 5s ago
Main PID: 10707 (xdg-desktop-por)
Tasks: 7 (limit: 18900)
Memory: 4.3M (peak: 5.0M)
CPU: 74ms
CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/xdg-desktop-portal.service
└─10707 /usr/lib/xdg-desktop-portal

Apr 07 14:45:29 archlinux systemd[651]: Starting Portal service...
Apr 07 14:45:29 archlinux xdg-desktop-por[10707]: Choosing gtk.portal for org.freedesktop.impl.portal.Lockdown as a last-resort fallback
Apr 07 14:45:29 archlinux xdg-desktop-por[10707]: The preferred method to match portal implementations to desktop environments is to …tion file
Apr 07 14:45:29 archlinux systemd[651]: Started Portal service.
Hint: Some lines were ellipsized, use -l to show in full.

$ systemctl --user status plasma-xdg-desktop-portal-kde.service
● plasma-xdg-desktop-portal-kde.service - Xdg Desktop Portal For KDE
Loaded: loaded (/usr/lib/systemd/user/plasma-xdg-desktop-portal-kde.service; static)
Active: active (running) since Sun 2024-04-07 14:45:14 EDT; 1min 14s ago
Main PID: 10654 (xdg-desktop-por)
Tasks: 10 (limit: 18900)
Memory: 37.4M (peak: 54.1M)
CPU: 1.169s
CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/plasma-xdg-desktop-portal-kde.service
├─10654 /usr/lib/xdg-desktop-portal-kde
└─10929 /usr/lib/kf6/kioworker /usr/lib/qt6/plugins/kf6/kio/tags.so tags "" local:/run/user/1000/xdg-desktop-portal-kdeWYXQev.1.k…

Apr 07 14:45:14 archlinux systemd[651]: Starting Xdg Desktop Portal For KDE...
Apr 07 14:45:14 archlinux systemd[651]: Started Xdg Desktop Portal For KDE.
Apr 07 14:45:29 archlinux xdg-desktop-portal-kde[10654]: xdp-kde-settings: Namespace  "org.gnome.desktop.interface"  is not supported
Apr 07 14:45:29 archlinux xdg-desktop-portal-kde[10654]: xdp-kde-settings: Namespace  "org.gnome.desktop.interface"  is not supported
Apr 07 14:45:47 archlinux xdg-desktop-portal-kde[10654]: QWindow::fromWinId(): platform plugin does not support foreign windows.
```
Comment 1 TraceyC 2024-09-22 20:10:34 UTC
From the linked bug report:
- The native version works OK on KDE Plasma
- The flatpak version has this error
- The file dialog in GNOME/sway + flatpak works fine

Running GoldenDict-ng from the app menu, it immediately exits.
Running GoldenDict-ng from command line, the first try worked but the second also exits
(This is unrelated to udisks, just noting for reference)

```
❯ flatpak run --branch=stable --arch=x86_64 --command=goldendict --file-forwarding io.github.xiaoyifang.goldendict_ng @@u %u @@
Qt: Session management error: Could not open network socket
No favorites file found
Load done

starting create the fts with thread: 6
waiting for all the fts creation to finish.
finished/cancel all the fts creation
QSystemTrayIcon::setVisible: No Icon set
reset inspector
wiki request begin

wiki request begin
```

Ran with this, which allows it to run.
```
flatpak run --branch=stable --arch=x86_64 --command=goldendict --file-forwarding io.github.xiaoyifang.goldendict_ng
```

I am able to add a dictionary folder, and the program does not crash.
I confirm, however, that I get these errors when clicking the Add button

```
kf.solid.backends.udisks2: Failed enumerating UDisks2 objects: "org.freedesktop.DBus.Error.Disconnected" 
 "Not connected to D-Bus server"
```