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. [SOLVED] QRectF crashes the GUI upon exiting
Qt 6.11 is out! See what's new in the release blog

[SOLVED] QRectF crashes the GUI upon exiting

Scheduled Pinned Locked Moved General and Desktop
19 Posts 4 Posters 5.3k 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.
  • N Offline
    N Offline
    nanthiran_2005
    wrote on last edited by
    #5

    I realized that the problem happens whenever I add a new variable (NOT a pointer variable) in .h file. So I believe it is memory issue as mentioned earlier. Is there way to solve it? At time being I am overcoming this problem by rebuilding the project.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
      wrote on last edited by
      #6

      May be change the order of variables you declare inside class and see how it goes.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      https://www.pthinks.com

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #7

        This sounds like your compiler somehow does not get the required dependency information, and does not recompile all files that use this changed header file.

        Is this a single project, or are you working with libraries?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          ambershark
          wrote on last edited by
          #8

          Yea it's not memory corruption. It is the compiler not picking up the header changes, thus forcing a rebuild to pick them up.

          Make sure you have the header files defined in your *.pro file.

          I.e.

          @
          HEADERS +=
          myheader.h
          anotherheader.h

          SOURCES +=
          myheader.cpp
          anotherheader.cpp
          @

          Without that HEADERS line it will seem to compile properly but won't actually pick up header changes and can cause some really weird issues (at least with gcc).

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

          1 Reply Last reply
          0
          • N Offline
            N Offline
            nanthiran_2005
            wrote on last edited by
            #9

            The header files are already included. asperamanca yes I am working with qwt library.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              ambershark
              wrote on last edited by
              #10

              Can you post your .pro file? Also what is your compiler? Are you using an IDE (msvc/qt creator/etc)?

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

              1 Reply Last reply
              0
              • N Offline
                N Offline
                nanthiran_2005
                wrote on last edited by
                #11

                Attached below is my .pro file. I am currently using Qt Creator 5.3.

                @
                QT += core gui

                greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                TARGET = gui
                TEMPLATE = app

                HEADERS += widget.h
                data.h
                graph.h
                barchart.h
                udp.h
                gauge.h
                gauge2.h

                SOURCES += main.cpp
                widget.cpp
                data.cpp
                graph.cpp
                barchart.cpp
                udp.cpp
                gauge.cpp
                gauge2.cpp

                FORMS += widget.ui

                QT += multimedia

                win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../Qwt-6.1.0/lib/ -lqwt
                else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../Qwt-6.1.0/lib/ -lqwtd

                INCLUDEPATH += $$PWD/../../../../../../Qwt-6.1.0/include
                DEPENDPATH += $$PWD/../../../../../../Qwt-6.1.0/include
                @

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  ambershark
                  wrote on last edited by
                  #12

                  Is your compiler mingw or msvc? I'm going to guess msvc cause your pro file looks good with the headers so mingw shouldn't be having the missing .h file checks that is causing your problem.

                  If it is msvc I'll have to let someone else help you. I don't really use it anymore, I think I have one legacy project that still uses it over mingw, but I haven't put any time into it since like 2000. So I just don't have the knowledge of it's idiosyncrasies.

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

                  1 Reply Last reply
                  0
                  • N Offline
                    N Offline
                    nanthiran_2005
                    wrote on last edited by
                    #13

                    I am using MinGW 4.8.2 compiler.

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      ambershark
                      wrote on last edited by
                      #14

                      Hmm, if it's mingw this is definitely odd behavior indeed.

                      Maybe try running qmake to make sure that your project.pro.user file is up to date.

                      If it were me I would take it down to the command line and cut out the ide. Then use:

                      @
                      $ qmake
                      $ make
                      @

                      And then once the build is complete, modify that header file (add a variable or whatever), touch the corresponding cpp file and make again. If it picks it up then it should be fine, there may be an issue with your ide at that point.

                      I don't know what else it could be it's a weird problem.

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

                      1 Reply Last reply
                      0
                      • N Offline
                        N Offline
                        nanthiran_2005
                        wrote on last edited by
                        #15

                        I did as you said. And at the time the problem is not there after I add a variable and make changes in the corresponding .cpp file.

                        I hope that really solves it.

                        Thanks ambershark.

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          ambershark
                          wrote on last edited by
                          #16

                          No problem. I'm guessing you may have just needed to run a qmake. You probably added the header to the pro file and Qt Creator never re-ran qmake thus it didn't realize things had changed.

                          Just a guess without seeing it, but I'm pretty sure that's what happened if the qmake/make worked for you. :)

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

                          1 Reply Last reply
                          0
                          • N Offline
                            N Offline
                            nanthiran_2005
                            wrote on last edited by
                            #17

                            I see. Yes, I actually never re-run the qmake every time after I add a new header file. I didn't know that I have to.

                            Thank you ambershark

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              ambershark
                              wrote on last edited by
                              #18

                              Yea I got in the habit of making sure I qmake all the time. I do it a lot even when I don't need to. Nothing more annoying than searching out a compiler issue because you didn't qmake. :)

                              Anyway, that being said, just make sure you do it after any changes to your pro file. If you are using Qt Creator I thought this was supposed to be automatic. I'm not sure though I tend to use SlickEdit or just vim for editing and build via qmake/make on the command line or in slickedit. So I always need to run qmake manually.

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

                              1 Reply Last reply
                              0
                              • N Offline
                                N Offline
                                nanthiran_2005
                                wrote on last edited by
                                #19

                                I think even in QT Creator we need to manually run the qmake. Have a look at this "thread":http://qt-project.org/forums/viewthread/40352.

                                Anyway thank you for the reply. By running the qmake everytime after adding a .h file, the problem is no longer there.

                                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