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. QtSingleApplication crash
Forum Updated to NodeBB v4.3 + New Features

QtSingleApplication crash

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 2.5k Views 2 Watching
  • 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.
  • X Offline
    X Offline
    xiaofeng
    wrote on last edited by A Former User
    #1

    Re: QLocalServer crashes when QString is used instead of "string_literal"

    qt version: 5.6.1
    qtsingleapplication version: 2.6.1

    1  __strlen_sse2_pminub                                                                   0x7ffff5173e71 
    2  QCoreApplication::arguments()                                                          0x7ffff62ea2fd 
    3  sm_performSaveYourself(QXcbSessionManager *)                                           0x7fffe4d19470 
    4  sm_saveYourselfCallback(_SmcConn *, void *, int, int, int, int)                        0x7fffe4d19fe5 
    5  _SmcProcessMessage                                                                     0x7fffedb9ec4d 
    6  IceProcessMessages                                                                     0x7fffeddb2ab7 
    7  QMetaObject::activate(QObject *, int, int, void * *)                                   0x7ffff630ece1 
    8  QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal)                       0x7ffff638067e 
    9  QSocketNotifier::event(QEvent *)                                                       0x7ffff631b809 
    10 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                0x7ffff6d30bec 
    11 QApplication::notify(QObject *, QEvent *)                                              0x7ffff6d355b2 
    12 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                 0x7ffff62e6d86 
    13 socketNotifierSourceDispatch(_GSource *, int ( *)(void *), void *)                     0x7ffff6334ca0 
    14 g_main_context_dispatch                                                                0x7ffff4070d7a 
    15 g_main_context_iterate.isra.24                                                         0x7ffff40710b8 
    16 g_main_context_iteration                                                               0x7ffff407116c 
    17 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)             0x7ffff633409c 
    18 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)                                0x7ffff62e58eb 
    19 QCoreApplication::exec()                                                               0x7ffff62ed426 
    20 main                                                                       main.cpp 88 0x45bdce       
    
    A 1 Reply Last reply
    0
    • A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      I think I know what's going on. Can I see your main?

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0
      • X xiaofeng

        Re: QLocalServer crashes when QString is used instead of "string_literal"

        qt version: 5.6.1
        qtsingleapplication version: 2.6.1

        1  __strlen_sse2_pminub                                                                   0x7ffff5173e71 
        2  QCoreApplication::arguments()                                                          0x7ffff62ea2fd 
        3  sm_performSaveYourself(QXcbSessionManager *)                                           0x7fffe4d19470 
        4  sm_saveYourselfCallback(_SmcConn *, void *, int, int, int, int)                        0x7fffe4d19fe5 
        5  _SmcProcessMessage                                                                     0x7fffedb9ec4d 
        6  IceProcessMessages                                                                     0x7fffeddb2ab7 
        7  QMetaObject::activate(QObject *, int, int, void * *)                                   0x7ffff630ece1 
        8  QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal)                       0x7ffff638067e 
        9  QSocketNotifier::event(QEvent *)                                                       0x7ffff631b809 
        10 QApplicationPrivate::notify_helper(QObject *, QEvent *)                                0x7ffff6d30bec 
        11 QApplication::notify(QObject *, QEvent *)                                              0x7ffff6d355b2 
        12 QCoreApplication::notifyInternal2(QObject *, QEvent *)                                 0x7ffff62e6d86 
        13 socketNotifierSourceDispatch(_GSource *, int ( *)(void *), void *)                     0x7ffff6334ca0 
        14 g_main_context_dispatch                                                                0x7ffff4070d7a 
        15 g_main_context_iterate.isra.24                                                         0x7ffff40710b8 
        16 g_main_context_iteration                                                               0x7ffff407116c 
        17 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)             0x7ffff633409c 
        18 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)                                0x7ffff62e58eb 
        19 QCoreApplication::exec()                                                               0x7ffff62ed426 
        20 main                                                                       main.cpp 88 0x45bdce       
        
        A Offline
        A Offline
        ambershark
        wrote on last edited by
        #3

        @xiaofeng Nevermind I see the code in the thread you linked, and confirmed my suspicion.

        SingleInstance::SingleInstance(int argc, char *argv[]) :
            QApplication(argc, argv),
            mServerName("foo")
        {
        

        If you see here SingleInstance takes an int argc instead of int &argc, any argc passed to QApplication needs to be modifiable and as it's a reference. Change your definition to int &argc and your crash will be gone.

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply
        2
        • X Offline
          X Offline
          xiaofeng
          wrote on last edited by
          #4

          @ambershark Thanks so much. I didn't recognize it's an int &argc for so many years, thanks.

          A 1 Reply Last reply
          0
          • X xiaofeng

            @ambershark Thanks so much. I didn't recognize it's an int &argc for so many years, thanks.

            A Offline
            A Offline
            ambershark
            wrote on last edited by
            #5

            @xiaofeng Don't worry, it got me too. That's how I knew what was going on, lol. It was not an easy bug to find either. I'm not sure why they do the int &, but it causes some real problems for people. :)

            My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

            kshegunovK 1 Reply Last reply
            0
            • A ambershark

              @xiaofeng Don't worry, it got me too. That's how I knew what was going on, lol. It was not an easy bug to find either. I'm not sure why they do the int &, but it causes some real problems for people. :)

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #6

              @ambershark said in qtsingleapplication crash:

              I'm not sure why they do the int &

              Because QCoreApplication processes and possibly modifies the command line, as it has its own set of flags it responds to.

              Read and abide by the Qt Code of Conduct

              A 1 Reply Last reply
              2
              • kshegunovK kshegunov

                @ambershark said in qtsingleapplication crash:

                I'm not sure why they do the int &

                Because QCoreApplication processes and possibly modifies the command line, as it has its own set of flags it responds to.

                A Offline
                A Offline
                ambershark
                wrote on last edited by
                #7

                @kshegunov Ah that makes a lot of sense. I figured they had a good reason for it. Qt is well thought out. :)

                My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                kshegunovK 1 Reply Last reply
                0
                • A ambershark

                  @kshegunov Ah that makes a lot of sense. I figured they had a good reason for it. Qt is well thought out. :)

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by
                  #8

                  @ambershark said in qtsingleapplication crash:

                  Qt is well thought out.

                  Most of it anyway ;P

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  1

                  • Login

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