Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Segfault when adding QMainWindow subclass to QMdiArea.

Segfault when adding QMainWindow subclass to QMdiArea.

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • equitukE Offline
    equitukE Offline
    equituk
    wrote on last edited by
    #1

    Hi all,

    I've believe I've found a reliable segfault under the following conditions:

    • building against Qt5.9.1 installed from the Kubuntu-Artful repositories
    • compiling with clang5 in c++14 mode
    • adding a subclass of QMainWindow to a QMdiArea and showing it
    • the subclass of QMainWindow uses a .ui file for its interface

    This segfault does not occur when building against Qt5.9.2 installed using the Qt-provided installer (i.e. the MaintenanceTool) on the same system. I've created a small example project here on GitHub that demonstrates the issue.

    First question, I suppose, is "is adding a QMainWindow to a QMdiArea a legitimate thing to do?" I think it is, but I get that it might be a bit of a niche case.

    Second question is "where should I report this?" My feeling is the Kubuntu Qt packagers but I'd appreciate some advice. Also, if anyone can (dis)confirm the existence of this issue I'd appreciate it so that I can rule out it being a peculiarity of my particular system.

    Thanks.

    VRoninV 1 Reply Last reply
    0
    • equitukE equituk

      Hi all,

      I've believe I've found a reliable segfault under the following conditions:

      • building against Qt5.9.1 installed from the Kubuntu-Artful repositories
      • compiling with clang5 in c++14 mode
      • adding a subclass of QMainWindow to a QMdiArea and showing it
      • the subclass of QMainWindow uses a .ui file for its interface

      This segfault does not occur when building against Qt5.9.2 installed using the Qt-provided installer (i.e. the MaintenanceTool) on the same system. I've created a small example project here on GitHub that demonstrates the issue.

      First question, I suppose, is "is adding a QMainWindow to a QMdiArea a legitimate thing to do?" I think it is, but I get that it might be a bit of a niche case.

      Second question is "where should I report this?" My feeling is the Kubuntu Qt packagers but I'd appreciate some advice. Also, if anyone can (dis)confirm the existence of this issue I'd appreciate it so that I can rule out it being a peculiarity of my particular system.

      Thanks.

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      Could not replicate on Qt 5.9.2 64bit MSVC2013 Windows

      Could you pinpoint the place (method, line) where the segfault occurs?

      is adding a QMainWindow to a QMdiArea a legitimate thing to do?

      100% yes

      where should I report this?

      https://bugreports.qt.io but since the bug is gone in Qt 5.9.2 I don't see what more can they do

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1
      • equitukE Offline
        equitukE Offline
        equituk
        wrote on last edited by
        #3

        Thanks for investigating. The segfault is in QWindow::winId(). Stack trace follows:

        QWindow::winId() const
        ??
        ??
        ??
        QMenuBar::eventFilter(QObject *, QEvent *)
        QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject *, QEvent *)
        QApplicationPrivate::notify_helper(QObject *, QEvent *)
        QApplication::notify(QObject *, QEvent *)
        QCoreApplication::notifyInternal2(QObject *, QEvent *)
        QWidget::setParent(QWidget *, QFlags<Qt::WindowType>)
        QLayout::addChildWidget(QWidget *)
        QLayout::addWidget(QWidget *)
        QMdiSubWindow::setWidget(QWidget *)
        QMdiArea::addSubWindow(QWidget *, QFlags<Qt::WindowType>)
        MainWindow::MainWindow(QWidget *)::$_0::operator()() const   [mainwindow.cpp:15]
        QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, MainWindow::MainWindow(QWidget *)::$_0>::call(MainWindow::MainWindow(QWidget *)::$_0&, void * *)   [qobjectdefs_impl.h:130]
        QtPrivate::Functor<MainWindow::MainWindow(QWidget *)::$_0, 0>::call<QtPrivate::List<>, void>(MainWindow::MainWindow(QWidget *)::$_0&, void *, void * *)   [qobjectdefs_impl.h:240]
        QtPrivate::QFunctorSlotObject<MainWindow::MainWindow(QWidget *)::$_0, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void * *, bool *)   [qobject_impl.h:168]
        QMetaObject::activate(QObject *, int, int, void * *)
        QAction::triggered(bool)
        
        1 Reply Last reply
        0
        • equitukE Offline
          equitukE Offline
          equituk
          wrote on last edited by
          #4

          OK. So I've tracked down the issue a bit further. In the stack trace above, those "??" calls toward the top are in the KDEPlasmaPlatformTheme.so shared library, and this coupled with the fact that these are being called from within QMenuBar made me think that perhaps it's the Plasma "Global Menu" widget that's triggering the problem. And so it seems. So the issue is repeatable in the following circumstances:

          • running on KDE Plasma
          • having one (or more) Global Menu widgets in a panel or on the desktop
          • having the setting "Application Style/Fine Tuning/Menubar Style" set to "Application Menu widget" in the KDE System Settings application.
          • The QMainWindow being added to the MDI area has a menu bar.

          My conclusion, therefore, is that I need to report this as an issue for KDE Plasma.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved