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. Can not understand the origin of an exeption.
Qt 6.11 is out! See what's new in the release blog

Can not understand the origin of an exeption.

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.1k Views 1 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.
  • J Offline
    J Offline
    jenya7
    wrote on last edited by jenya7
    #1

    When I press Run I get
    error: An exception was triggered:
    Exception at 0x6b78f704, code: 0xc0000602: , flags=0x0.

    But I see now errors in the code.
    How can I understand what's going on?

    It worked good, I added some code - the exception was generated, I removed the code but the exception stays.

    OK. I found the problem
    added
    static QMessageBox msgBox; in cpp file
    and then in a function I use it
    msgBox.setText("Unable to open the sys motor param file");
    msgBox.exec();

    It crashes at static QMessageBox msgBox - so I should create a new instance of QMessageBox in every function?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Don't create static QObject based objects. They need to have at least a QCoreApplication instance so the Qt internals are setup properly.

      By the way, why do you want a static QMessageBox.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      4
      • SGaistS SGaist

        Hi,

        Don't create static QObject based objects. They need to have at least a QCoreApplication instance so the Qt internals are setup properly.

        By the way, why do you want a static QMessageBox.

        J Offline
        J Offline
        jenya7
        wrote on last edited by
        #3

        @SGaist said in Can not understand the origin of an exeption.:

        Hi,

        Don't create static QObject based objects. They need to have at least a QCoreApplication instance so the Qt internals are setup properly.

        By the way, why do you want a static QMessageBox.

        I use it in several functions in the file. So instead of create QMessageBox every time in a function I'd create it once. I guess I was wrong.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          If this is in the context of a class, you can make it a member variable.

          Otherwise, if you show the same message each time, make that a function that you call from the several places you need.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          3

          • Login

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