Hi,
I am getting "access violation writing location 0x00000020" on VS2010 (Windows 7) while I try to read a big tiff file into a QPixmap. The visual debugger bring me at the following location in qpixmap_raster.cpp where it says the problem is occurring:
{
// image has alpha format but is really opaque, so try to do a
// more efficient conversion
if (sourceImage.
format() == QImage::Format_ARGB32 || sourceImage.
format() == QImage::Format_ARGB32_Premultiplied) {
if (!inPlace)
sourceImage.detach();
sourceImage.
d->format
= QImage::Format_RGB32;
//<<=========== Debugger is here. }
format = opaqueFormat;
} else {
format = alphaFormat;
}
{
// image has alpha format but is really opaque, so try to do a
// more efficient conversion
if (sourceImage.format() == QImage::Format_ARGB32
|| sourceImage.format() == QImage::Format_ARGB32_Premultiplied)
{
if (!inPlace)
sourceImage.detach();
sourceImage.d->format = QImage::Format_RGB32; //<<=========== Debugger is here.
}
format = opaqueFormat;
} else {
format = alphaFormat;
}
To copy to clipboard, switch view to plain text mode
The above function gets called due to the following code in my source file:
if (thisPic.load(itr->second.c_str()) == false ){ //<<<==== this line causing the access violation
std::cerr << "Could not load pixmap from " << itrZ->second.c_str() << std::endl;
} else {
..... other code...
}
QPixmap thisPic;
if (thisPic.load(itr->second.c_str()) == false ){ //<<<==== this line causing the access violation
std::cerr << "Could not load pixmap from " << itrZ->second.c_str() << std::endl;
} else {
..... other code...
}
To copy to clipboard, switch view to plain text mode
The above problem is using Qt 4.8.6 on a Windows 7 box, MS VS2010, compiled in Win32 mode.
However, it turns out that the program runs fine on a Linux box, in 64 bits, using Qt 4.8.7. Also runs fine on a Windows 7 box while compiled in 64 bit mode, running Qt 5.6.
Now, granted that I am reading in large images, around 40 MB, a total of 9 images. Could be stack related issues? How should I go about finding out the exact problem? Advice?
Thanks.
Bookmarks