最新在处理opencv的时候遇到(Qt5Gui.dll)处(位于 xxx.exe 中)引发的异常: 0xC0000005: 读取位置 XXXXXXXX 时发生访问冲突,导致上位机崩溃严重影响开发的效率。
简要代码:

void show()
{
QImage img = QImage(data,width,height,bytePerLine,QImage::Format_RGB888);
emit img;
}

void showImg(const QImage img) {
 setPixmap(QPixmap::fromImage(img));
}

代码运行起来崩溃 QPixmap此处,渲染崩溃。由于是考虑 多线程,空指针,指针被释放等一些问题,依然解决不了。最终将代码修改成如下,成功解决。

void show()
{
QImage img = QImage(data,width,height,bytePerLine,QImage::Format_RGB888).copy();
emit img;
}

void showImg(const QImage img) {
 setPixmap(QPixmap::fromImage(img));
}
10-11 17:10