Corrupted heap space using QtXmld4.dll (VS 2010)
-
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.
-
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?
-
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? -
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).
-
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