Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-129293

QHash doesn't play nicely with std::shared_ptr as value type

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 6.7.2
    • None
    • Linux/Wayland, Linux/X11

    Description

      I have no idea how to reproduce it, but replacing QHash with std::unordered_map fixes the crash. It seems the shared pointer doesn't correctly count its usage when multiple keys have the same shared pointer and a key of them is being removed.

      https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4745

      libkickerplugin+0x04ce25KAStatsFavoritesModel::Private::removeResult (kastatsfavoritesmodel.cpp:394)
      libkickerplugin+0x04dcb3KAStatsFavoritesModel::Private::Private::lambda::operator() (kastatsfavoritesmodel.cpp:205)
      libkickerplugin+0x04dcb3QtPrivate::FunctorCall<T>::call (qobjectdefs_impl.h:137)
      libkickerplugin+0x04dcb3QtPrivate::FunctorCallable<T>::call<T> (qobjectdefs_impl.h:345)
      libkickerplugin+0x04dcb3QtPrivate::QCallableObject<T>::impl (qobjectdefs_impl.h:555)
      libQt6Core.so.6.7.2+0x1eddcaQObject::event (qobject.cpp:1452)
      libQt6Widgets.so.6.7.2+0x18b217QApplicationPrivate::notify_helper (qapplication.cpp:3287)
      libQt6Core.so.6.7.2+0x196e87QCoreApplication::notifyInternal2 (qcoreapplication.cpp:1142)
      libQt6Core.so.6.7.2+0x19ac50QCoreApplicationPrivate::sendPostedEvents (qcoreapplication.cpp:1940)
      libQt6Core.so.6.7.2+0x4859eepostEventSourceDispatch (qeventdispatcher_glib.cpp:244)
      libglib-2.0.so.0.8000.3+0x05ce8bg_main_dispatch (gmain.c:3344)
      libglib-2.0.so.0.8000.3+0x05ce8bg_main_context_dispatch_unlocked.lto_priv.0 (gmain.c:4152)
      libglib-2.0.so.0.8000.3+0x0bec97g_main_context_iterate_unlocked.isra.0 (gmain.c:4217)
      libglib-2.0.so.0.8000.3+0x05e382g_main_context_iteration (gmain.c:4282)
      libQt6Core.so.6.7.2+0x4851a2QEventDispatcherGlib::processEvents (qeventdispatcher_glib.cpp:394)
      libQt6Core.so.6.7.2+0x1a3bc2QEventLoop::exec (qeventloop.cpp:182)
      libQt6Core.so.6.7.2+0x19fa7bQCoreApplication::exec (qcoreapplication.cpp:1486)
      plasmashell+0x02eb39main (main.cpp:188)
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            fusionfuture Yuanzheng Wang
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes