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. Application crash on startup : error 0xc0000005
Forum Updated to NodeBB v4.3 + New Features

Application crash on startup : error 0xc0000005

Scheduled Pinned Locked Moved Solved General and Desktop
26 Posts 9 Posters 19.8k Views 3 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.
  • N Offline
    N Offline
    nwoki
    wrote on last edited by
    #17

    So, turns out that the only error message that was telling the truth was the one regarding the QAction : Qt5Widgets!QAction::setText+0x1:.

    What was happening was the following:

    I've implemented a "Recent files" QMenu where i set the last 5 recent files used by the client. What happened in this particular case was that the client removed some recent files that were stashed by my application (their path url) and so when I want to load them into the menu with:

        for (int i = 0; i < recentFiles.count(); ++i) {
            QAction *rf = m_recentFilesActions.at(i);
            rf->setText(QFileInfo(recentFiles.at(i)).fileName());
            rf->setData(recentFiles.at(i));
            rf->setVisible(true);
        }
    

    the application crashed.

    What threw me off was the first part of the debug message

    (2a38.880): Access violation - code c0000005 (first chance)
    First chance exceptions are reported before any exception handling.
    This exception may be expected and handled.
    *** WARNING: Unable to verify checksum for C:\Users\user\Desktop\goforit\Qt5Widgets.dll
    *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Users\user\Desktop\goforit\Qt5Widgets.dll - 
    *** WARNING: Unable to verify checksum for C:\Users\user\Desktop\goforit\app.exe
    *** ERROR: Module load completed but symbols could not be loaded for C:\Users\user\Desktop\goforit\app.exe
    

    which led me to think it was a problem concerning the graphical driver of the client as he told me he had done some updates lately and that the access error was related to the QWidgets.dll file.

    Once I fixed that, the application went back to normal. Thankyou @ambershark and @hskoglund (you're last comment helped me find the problem) for your help. I've also learned a few things on debugging under windows (i'm a linux guy).

    JonBJ A 2 Replies Last reply
    1
    • N nwoki

      So, turns out that the only error message that was telling the truth was the one regarding the QAction : Qt5Widgets!QAction::setText+0x1:.

      What was happening was the following:

      I've implemented a "Recent files" QMenu where i set the last 5 recent files used by the client. What happened in this particular case was that the client removed some recent files that were stashed by my application (their path url) and so when I want to load them into the menu with:

          for (int i = 0; i < recentFiles.count(); ++i) {
              QAction *rf = m_recentFilesActions.at(i);
              rf->setText(QFileInfo(recentFiles.at(i)).fileName());
              rf->setData(recentFiles.at(i));
              rf->setVisible(true);
          }
      

      the application crashed.

      What threw me off was the first part of the debug message

      (2a38.880): Access violation - code c0000005 (first chance)
      First chance exceptions are reported before any exception handling.
      This exception may be expected and handled.
      *** WARNING: Unable to verify checksum for C:\Users\user\Desktop\goforit\Qt5Widgets.dll
      *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Users\user\Desktop\goforit\Qt5Widgets.dll - 
      *** WARNING: Unable to verify checksum for C:\Users\user\Desktop\goforit\app.exe
      *** ERROR: Module load completed but symbols could not be loaded for C:\Users\user\Desktop\goforit\app.exe
      

      which led me to think it was a problem concerning the graphical driver of the client as he told me he had done some updates lately and that the access error was related to the QWidgets.dll file.

      Once I fixed that, the application went back to normal. Thankyou @ambershark and @hskoglund (you're last comment helped me find the problem) for your help. I've also learned a few things on debugging under windows (i'm a linux guy).

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #18

      @nwoki

      the application crashed.

      OOI. What actually crashed? The code you show? Do you mean m_recentFilesActions.at(i) was nullptr/invalid?

      N 1 Reply Last reply
      0
      • JonBJ JonB

        @nwoki

        the application crashed.

        OOI. What actually crashed? The code you show? Do you mean m_recentFilesActions.at(i) was nullptr/invalid?

        N Offline
        N Offline
        nwoki
        wrote on last edited by
        #19

        @JonB The line

        rf->setText(QFileInfo(recentFiles.at(i)).fileName());
        

        was the culprit as the QFileInfo was not being created seeing that the recent file had been moved.

        JonBJ 1 Reply Last reply
        0
        • N nwoki

          @JonB The line

          rf->setText(QFileInfo(recentFiles.at(i)).fileName());
          

          was the culprit as the QFileInfo was not being created seeing that the recent file had been moved.

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by JonB
          #20

          @nwoki
          I really do not understand this, for two reasons:

          1. When you try to create a QFileInfo(QString filepath) it does not fail if the path does not exist. If it did, there would be no point in having e.g. a QFileInfo::exists() function. AFAIK, the QFileInfo methods treat the filepath as a string to parse to produce results for extracting segments; they only try to access the file when a function which needs to do so is called. I therefore assume QFileInfo(recentFiles.at(i)).fileName()); would return the filename part of whatever you passed in.

          2. Even if that were not true, then either it would throw some exception possibly or it would return, say, an empty string for the filename. You would pass that to your rf->setText(), and whatever that did it would not "crash" on trying to set some text.

          I should be obliged if a Qt expert would correct me if the above is not true? Otherwise I do not see how in itself it would lead to the behaviour you have previously shown, which is why I asked.

          LimerL 1 Reply Last reply
          1
          • JonBJ JonB

            @nwoki
            I really do not understand this, for two reasons:

            1. When you try to create a QFileInfo(QString filepath) it does not fail if the path does not exist. If it did, there would be no point in having e.g. a QFileInfo::exists() function. AFAIK, the QFileInfo methods treat the filepath as a string to parse to produce results for extracting segments; they only try to access the file when a function which needs to do so is called. I therefore assume QFileInfo(recentFiles.at(i)).fileName()); would return the filename part of whatever you passed in.

            2. Even if that were not true, then either it would throw some exception possibly or it would return, say, an empty string for the filename. You would pass that to your rf->setText(), and whatever that did it would not "crash" on trying to set some text.

            I should be obliged if a Qt expert would correct me if the above is not true? Otherwise I do not see how in itself it would lead to the behaviour you have previously shown, which is why I asked.

            LimerL Offline
            LimerL Offline
            Limer
            wrote on last edited by
            #21

            @JonB https://forum.qt.io/topic/93393/gui-operations-are-performed-in-a-non-gui-thread

            Hope this helps you.

            JonBJ A 2 Replies Last reply
            0
            • LimerL Limer

              @JonB https://forum.qt.io/topic/93393/gui-operations-are-performed-in-a-non-gui-thread

              Hope this helps you.

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by
              #22

              @Limer I had no idea a non-GUI thread was involved!

              1 Reply Last reply
              0
              • N nwoki

                So, turns out that the only error message that was telling the truth was the one regarding the QAction : Qt5Widgets!QAction::setText+0x1:.

                What was happening was the following:

                I've implemented a "Recent files" QMenu where i set the last 5 recent files used by the client. What happened in this particular case was that the client removed some recent files that were stashed by my application (their path url) and so when I want to load them into the menu with:

                    for (int i = 0; i < recentFiles.count(); ++i) {
                        QAction *rf = m_recentFilesActions.at(i);
                        rf->setText(QFileInfo(recentFiles.at(i)).fileName());
                        rf->setData(recentFiles.at(i));
                        rf->setVisible(true);
                    }
                

                the application crashed.

                What threw me off was the first part of the debug message

                (2a38.880): Access violation - code c0000005 (first chance)
                First chance exceptions are reported before any exception handling.
                This exception may be expected and handled.
                *** WARNING: Unable to verify checksum for C:\Users\user\Desktop\goforit\Qt5Widgets.dll
                *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Users\user\Desktop\goforit\Qt5Widgets.dll - 
                *** WARNING: Unable to verify checksum for C:\Users\user\Desktop\goforit\app.exe
                *** ERROR: Module load completed but symbols could not be loaded for C:\Users\user\Desktop\goforit\app.exe
                

                which led me to think it was a problem concerning the graphical driver of the client as he told me he had done some updates lately and that the access error was related to the QWidgets.dll file.

                Once I fixed that, the application went back to normal. Thankyou @ambershark and @hskoglund (you're last comment helped me find the problem) for your help. I've also learned a few things on debugging under windows (i'm a linux guy).

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

                @nwoki I'm with @JonB on this ... I don't understand why it's failing.

                QFileInfo fi("").fileName() for instance should not crash at all. It's perfectly valid. So if your recents list had a cleaned up file it shouldn't have mattered at all.

                I only typically have linux environments to test with and it works fine in linux (but you already knew that). So if it fails in windows that is a Qt bug not a bug in your software. Assuming it's a crash in QFileInfo().fileName() which at worst should return an empty string, not crash.

                Glad you got it working but it may be a "fake" fix since there is no reason that should have crashed in windows or elsewhere.

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

                1 Reply Last reply
                1
                • LimerL Limer

                  @JonB https://forum.qt.io/topic/93393/gui-operations-are-performed-in-a-non-gui-thread

                  Hope this helps you.

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

                  @Limer said in Application crash on startup : error 0xc0000005:

                  thread

                  There was no mention in this posting about a non-gui thread at all. Not sure where you got that idea.

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

                  1 Reply Last reply
                  1
                  • S Offline
                    S Offline
                    sadia
                    Banned
                    wrote on last edited by
                    #25
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      Awaisserfriz
                      Banned
                      wrote on last edited by
                      #26
                      This post is deleted!
                      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