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. Corrupted heap space using QtXmld4.dll (VS 2010)
Forum Updated to NodeBB v4.3 + New Features

Corrupted heap space using QtXmld4.dll (VS 2010)

Scheduled Pinned Locked Moved General and Desktop
13 Posts 3 Posters 6.5k 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.
  • G Offline
    G Offline
    goetz
    wrote on last edited by
    #4

    Qt and the client code must be compiled and linked with the same linker flags. Do not mix them, otherwise you might end up using two different C/C++ runtimes, which leads to memory corruption when new is called in one implementation and delete in the other.

    http://www.catb.org/~esr/faqs/smart-questions.html

    1 Reply Last reply
    0
    • G Offline
      G Offline
      galrub
      wrote on last edited by
      #5

      well, they are, all /MTd and /MT (for release)

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #6

        Hm, strange. I've no clue what's going wrong there. Maybe someone else will jump in - I don't have VS2010 at hand to do a check myself.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply
        0
        • G Offline
          G Offline
          galrub
          wrote on last edited by
          #7

          I hope so, I will try creating a static library set, just to check, worst case, the XML parsing DLL I'm working on will be created using static libraries.

          anyone... HELP! hahaha

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on last edited by
            #8

            Are you sure, your Qt libs were build with /MTd and your binary also for debug and all with /MT for release?
            It looks (from the defect behavior) very like these do not fit together...

            How did you change the flags for Qt? Did you use dependency viewer to verify, Qt dies not use the redistributables?

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • G Offline
              G Offline
              galrub
              wrote on last edited by
              #9

              I will build again and run all the nmake output to a file...

              1 Reply Last reply
              0
              • G Offline
                G Offline
                galrub
                wrote on last edited by
                #10

                according to the build log (all 5Meg of it) there is no indication of any use of -MDd or -MD, just MT.

                I am not that strong in c/c++ but,
                according to the callstack we can see that the heap corruption is due to a call of a distructor of the passed &file, or one of it's components. so, we can say that the code itself cannot work with such parameters as -M, because of such call, right?

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  giesbert
                  wrote on last edited by
                  #11

                  Hi,

                  I thopught a bit about this, /MT means link against a static library, that means you add it to all binaries, you create. If you link a dll with /MT, the code is added to that dll. Then you link your executable againtst that and it is also added there. Then you have two different heaps, which leads to that crash. If you use /MT, you MUST use Qt as static library or use /MD (and the vc redistributables).

                  Nokia Certified Qt Specialist.
                  Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    galrub
                    wrote on last edited by
                    #12

                    thank you Gerolf, after sleeping on it, I came also to the same conclusion.

                    In order for QT to be used in such a way the code must be created with 'awareness' of two (or more) different heap spaces, so, I will be linking QT statically for the xml parser..

                    and, the more I think about it, the more it makes sense also.

                    so, thank you all for the help

                    1 Reply Last reply
                    0
                    • G Offline
                      G Offline
                      giesbert
                      wrote on last edited by
                      #13

                      I rhink, you have to link Qt complete statically, or use /MD. The Qt libraries are not memory neutral (which means, memory allocate din one library may be freed in another one).

                      Nokia Certified Qt Specialist.
                      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                      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