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

Segfault on Linux on destruction of members defined with Q_GLOBAL_STATIC_WITH_ARGS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.6.2
    • Core: Other
    • None
    • Linux
    • Linux/X11

    Description

      Kindly provide thoughts on our fix or suggest an alternative better fix. Refer: 
      attached git-commit-diff.txt

      NOTE: I have set the priority to P0: Blocker since our product release is blocked because of this bug.

      For the following two members defined in qtbase/src/gui/kernel/qplatformintegrationfactory.cpp

      Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
          (QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive))
      Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader,
                                (QPlatformIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive))
      

      Destruction on application exit shows segfault error 14 in linux dmesg for these two members.
      On converting these static global members to static class members of QPlatformIntegrationFactory removes the segfault.

      Refer to attached git-commit-diff.txt for the changes.

      OS: Ubuntu 16.04.3 LTS 64 bit

      Build Flags:

       ../configure -release -commercial \
       -opengl desktop \
       -nomake examples \
       -nomake tests \
       -confirm-license \
       -platform linux-clang-libc++ \
       -v \
       -I /usr/local/include \
       -L /usr/local/lib \
       -force-debug-info \
       -separate-debug-info \
       -skip qtandroidextras \
       -skip qtdoc \
       -skip qtmacextras \
       -skip qtmultimedia \
       -skip qtsensors \
       -skip qtserialport \
       -skip qtwayland \
       -skip qtwebsockets \
       -skip qtwinextras \
       -skip qtx11extras \
       -skip qtconnectivity \
       -skip qt3d \
       -skip qtcanvas3d \
       -skip qtsvg \
       -skip qtactiveqt \
       -skip qtquickcontrols2 \
       -skip qtserialbus \
       -qt-freetype \
       -qt-libjpeg \
       -qt-libpng \
       -qt-xcb \
       -skip enginio \
       -skip webengine \
       -skip qtactiveqt
      

      Starting point of this whole issue is the following call in our code. 

       static int argc = 1;
       static char* argv[] = { "com.xxx.xxxxxx:Plugin" };
       QGuiApplication* g_app = new QGuiApplication(argc, argv);
      

      If we remove this call, there is no segfault. Analyzing stack track on segfault with gdb led to the above 2 members.

      Compiler used: clang-3.7

      $ clang-3.7 --version
      Ubuntu clang version 3.7.1-2ubuntu2 (tags/RELEASE_371/final) (based on LLVM 3.7.1)
      Target: x86_64-pc-linux-gnu
      Thread model: posix
      

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            rohit.ratnakumar Rohit Ratnakumar
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes