> On sexta-feira, 11 de janeiro de 2013 13.32.35, Shaw Andy wrote:
> > Unfortunately this is what is happening now if ICU is linked in, ICU will
> > always use the release version so if Qt is built in debug mode then it will
> > end up mixing the C runtime libraries.
> 
> 
> > Either way I feel that this needs to be fixed ASAP because we could end up
> > seeing bug reports that are in effect caused by this and end up creating
> > more noise as a result.   A short term option (and potentially permanent)
> > would be to link against a different version of the ICU libraries and point
> > out that if they want to use Qt in debug they would need to build ICU
> > themselves and make the relevant modifications to the output library
> names.
> 
> As far as I know, mixing C++ (not C!) runtime libraries is permitted, provided
> that certain care is taken, especially that the runtime that allocated memory
> must be the one to free it.
> 
> I think we are taking such care (we don't free any memory allocated by ICU).
> 
> So what exactly is the problem we need to solve? Has anyone noticed a crash,
> a
> warning from the C++ runtime, etc.? Is there a latent issue we just haven't
> hit?

Usually with this sort of thing it does not crash right away, you usually get a 
crash later on that looks strange and gets blamed on memory corruption, I have 
seen a crash that only happened in a prebuilt version of Qt which did not 
happen in my own build of Qt 5 which basically was an unhandled exception but I 
couldn't see what caused the exception since the stack trace did not give 
anything useful.  The very same example when running on a source build of Qt 
worked fine.  For reference the example was the browser one in the 
webkitwidgets examples directory crashing in the commercial 2010 binary 
package, it crashed every time it started up and it is because of that why I 
saw the mixing of the runtimes.

Microsoft in the past has also said that you should keep the -MD(d)/-MT(d) 
setting consistent so it is the same across all libraries and applications, and 
I have personally seen the result of this sort of thing happening which is why 
I have always recommended that everything is kept consistent to prevent this 
sort of thing from being a problem.  Granted it might be the case that we are 
generally very careful about it and we never really hit the problem, but 
wouldn't it be better to err on the side of caution and link against a debug 
version of ICU for the debug build of Qt?  If people want to override it then 
we could make that easy to do but personally I think we should at least be 
setup to do what would be the recommended thing to prevent any undue problems.

Andy
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to