Bug 464149 - Q_ASSERT(dev->backendObject() != nullptr);
Summary: Q_ASSERT(dev->backendObject() != nullptr);
Status: RESOLVED FIXED
Alias: None
Product: frameworks-solid
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.101.0
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
: 458609 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-01-11 13:30 UTC by Christoph Cullmann
Modified: 2024-11-05 22:08 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.8
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Cullmann 2023-01-11 13:30:10 UTC
On ejecting a DVD I got

Error getting props: "org.freedesktop.DBus.Error.InvalidArgs" "No such interface “org.freedesktop.UDisks2.Filesystem”" for "/org/freedesktop/UDisks2/block_devices/sr0"
ASSERT: "dev->backendObject() != nullptr" in file /local/hdd/gebhard/kde/src/frameworks/solid/src/solid/devices/frontend/devicemanager.cpp, line 234

I would propose to relax the code


void Solid::DeviceManagerPrivate::_k_deviceRemoved(const QString &udi)
{
    if (m_devicesMap.contains(udi)) {
        DevicePrivate *dev = m_devicesMap[udi].data();

        // Ok, this one was requested somewhere was valid
        // and now becomes magically invalid!

        if (dev) {
            Q_ASSERT(dev->backendObject() != nullptr);
            dev->setBackendObject(nullptr);
            Q_ASSERT(dev->backendObject() == nullptr);
        }
    }

    Q_EMIT deviceRemoved(udi);
}
Comment 1 Bug Janitor Service 2024-05-01 19:20:49 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/solid/-/merge_requests/165
Comment 2 Christoph Cullmann 2024-05-03 10:25:06 UTC
*** Bug 458609 has been marked as a duplicate of this bug. ***
Comment 3 Christoph Cullmann 2024-05-03 10:27:35 UTC
Git commit f099efda7a38e7f3651a802a44cd7e125b065dc1 by Christoph Cullmann.
Committed on 03/05/2024 at 10:23.
Pushed by cullmann into branch 'master'.

remove too aggressive assert

can happen during runtime, we set it to nullptr anyways,
just remove the assert

M  +0    -1    src/solid/devices/frontend/devicemanager.cpp

https://invent.kde.org/frameworks/solid/-/commit/f099efda7a38e7f3651a802a44cd7e125b065dc1
Comment 4 Bug Janitor Service 2024-09-01 21:29:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/solid/-/merge_requests/172
Comment 5 Christoph Cullmann 2024-10-19 10:29:58 UTC
Git commit 99510948944ecda04f9cec6b3bd94b140d191a1c by Christoph Cullmann, on behalf of Nicolas Fella.
Committed on 19/10/2024 at 10:27.
Pushed by cullmann into branch 'master'.

[udisks] Don't add/remove devices in slotMediaChanged

We get notified when devices are added via
InterfacesAdded/InterfacesRemoved.

When ejecting from a CD drive we first get slotMediaChanged, where we
remove the device from m_deviceCache. Then we get InterfacesRemoved
for org.freedesktop.UDisks2.Filesystem. Because the
org.freedesktop.UDisks2.Block interface is still there we remove and
immediately readd the device. Then in DeviceManagerPrivate::_k_deviceAdded
we call createBackendObject, which fails to create a backend because
the uid is not in m_deviceCache any more. Then we assert because the
backend is empty.

SENTRY: KIO-6S

SENTRY: KONTACT-FM

SENTRY: KDED-P

SENTRY: PLASMA-WORKSPACE-SMH

SENTRY: ARK-5T

SENTRY: DOLPHIN-218

M  +0    -13   src/solid/devices/backends/udisks2/udisksmanager.cpp

https://invent.kde.org/frameworks/solid/-/commit/99510948944ecda04f9cec6b3bd94b140d191a1c