PDA

View Full Version : QPrinterInfo::availablePrinters() causes heap corruption in 4.7.1



andyp
20th December 2010, 16:17
On Win32, using QT 4.7.1, why do I always get a "trying to free an invalid heap pointer" crash when the following goes out of scope:

{
QList<QPrinterInfo> list = QPrinterInfo::availablePrinters();
// ... some more code (or no code at all)
}
every time !!!

The crash happens in the C++ destructor of QList<QPrinterInfo>.
It happens irrespective of current thread (GUI or otherwise).

I had the problem in 4.5.3.It went away in 4.6.2 but it is back in 4.7.1.

Any help would be greatly appreciated.

Pinocchio
30th March 2011, 12:51
I had a similar problem: I was using Qt compiled with MSVC2008 in a project MSVC2010. The solution is to compile Qt with MSVC2010 or switch to MSVC2008 in your project.