https://bugs.kde.org/show_bug.cgi?id=374568

            Bug ID: 374568
           Summary: Applications crash when menu bar is accessed
           Product: QtCurve
           Version: git
          Platform: Gentoo Packages
                OS: Linux
            Status: UNCONFIRMED
          Severity: crash
          Priority: NOR
         Component: qt5
          Assignee: yyc1...@gmail.com
          Reporter: eugene.shalygin+bugzilla....@gmail.com
                CC: h...@kde.org
  Target Milestone: ---

GCC 6.3.0, -fsanitaze=address

==31500==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc
0x7ff7ec132047 bp 0x7ffd660bc7c0 sp 0x7ffd660bc740 T0)
    #0 0x7ff7ec132046 in QString::startsWith(QString const&,
Qt::CaseSensitivity) const (/usr/lib64/libQt5Core.so.5+0x121046)
    #1 0x7ff7cfbb5a6e in determineFileName
/home/eugene/develop/KDE/live/qtcurve/qt5/common/config_file.cpp:51
    #2 0x7ff7cfb5b67a in loadImage(QString const&, QtCPixmap*)
(/home/eugene/develop/KDE/live/qtcurve/build/qt5/style/qtcurve.so+0x1867a)
    #3 0x7ff7cfbabbc1 in QtCurve::updateMenuBarEvent(QMouseEvent*, QMenuBar*)
/home/eugene/develop/KDE/live/qtcurve/qt5/style/qtcurve_utils.cpp:250
    #4 0x7ff7cfb7f42a in QtCurve::Style::eventFilter(QObject*, QEvent*)
/home/eugene/develop/KDE/live/qtcurve/qt5/style/qtcurve_api.cpp:969
    #5 0x7ff7ec2496d1 in
QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*)
(/usr/lib64/libQt5Core.so.5+0x2386d1)
    #6 0x7ff7eca69a34 in QApplicationPrivate::notify_helper(QObject*, QEvent*)
(/usr/lib64/libQt5Widgets.so.5+0x159a34)
    #7 0x7ff7eca7174c in QApplication::notify(QObject*, QEvent*)
(/usr/lib64/libQt5Widgets.so.5+0x16174c)
    #8 0x7ff7ec249899 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
(/usr/lib64/libQt5Core.so.5+0x238899)
    #9 0x7ff7eca701cc in QApplicationPrivate::sendMouseEvent(QWidget*,
QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool)
(/usr/lib64/libQt5Widgets.so.5+0x1601cc)
    #10 0x7ff7ecac7f2d  (/usr/lib64/libQt5Widgets.so.5+0x1b7f2d)
    #11 0x7ff7ecaca7da  (/usr/lib64/libQt5Widgets.so.5+0x1ba7da)
    #12 0x7ff7eca69a5b in QApplicationPrivate::notify_helper(QObject*, QEvent*)
(/usr/lib64/libQt5Widgets.so.5+0x159a5b)
    #13 0x7ff7eca70c08 in QApplication::notify(QObject*, QEvent*)
(/usr/lib64/libQt5Widgets.so.5+0x160c08)
    #14 0x7ff7ec249899 in QCoreApplication::notifyInternal2(QObject*, QEvent*)
(/usr/lib64/libQt5Core.so.5+0x238899)
    #15 0x7ff7ec57b752 in
QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*)
(/usr/lib64/libQt5Gui.so.5+0xf0752)
    #16 0x7ff7ec57d174 in
QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*)
(/usr/lib64/libQt5Gui.so.5+0xf2174)
    #17 0x7ff7ec55f51a in
QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)
(/usr/lib64/libQt5Gui.so.5+0xd451a)
    #18 0x7ff7d57723bf  (/usr/lib64/libQt5XcbQpa.so.5+0x703bf)
    #19 0x7ff7e2be8096 in g_main_context_dispatch
(/usr/lib64/libglib-2.0.so.0+0x49096)
    #20 0x7ff7e2be82c7  (/usr/lib64/libglib-2.0.so.0+0x492c7)
    #21 0x7ff7e2be836b in g_main_context_iteration
(/usr/lib64/libglib-2.0.so.0+0x4936b)
    #22 0x7ff7ec294fae in
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)
(/usr/lib64/libQt5Core.so.5+0x283fae)
    #23 0x7ff7ec248929 in
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)
(/usr/lib64/libQt5Core.so.5+0x237929)
    #24 0x7ff7ec25014c in QCoreApplication::exec()
(/usr/lib64/libQt5Core.so.5+0x23f14c)
    #25 0x4038f0  (/usr/bin/pictorialist+0x4038f0)
    #26 0x7ff7eb387740 in __libc_start_main (/lib64/libc.so.6+0x20740)
    #27 0x404148  (/usr/bin/pictorialist+0x404148)

The stacktrace is strange and seems to be corrupted. I don't understand how the
hack in updateMenuBarEvent() could work, but since QObject::event() is virtual
and public, I propose the following change:

diff --git a/qt5/style/qtcurve_utils.cpp b/qt5/style/qtcurve_utils.cpp
index 608876b1..057d4f15 100644
--- a/qt5/style/qtcurve_utils.cpp
+++ b/qt5/style/qtcurve_utils.cpp
@@ -238,16 +238,8 @@ updateMenuBarEvent(QMouseEvent *event, QMenuBar *menu)
         }
     };

-    struct HackedMenu: public QMenuBar {
-        void
-        send(QMouseEvent *ev)
-        {
-            event(ev);
-        }
-    };
-
     if (((HackEvent*)event)->adjust()) {
-        ((HackedMenu*)menu)->send(event);
+        static_cast<QObject*>(menu)->event(event);
         return true;
     }
     return false;

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to