"Unhandled exception in app.exe (QtGuid4.dll): 0xC0000005: Access Violation"错误解决
2015-01-04 13:36
627 查看
本文要解决的Qt调试问题截图如下:
[align=left] [/align]
起因:在代码中添加类型为QColor的二维数组,存储图片每个像素。
现象:调试时出现上图所示错误。
原因:经过百度以及反复查看代码,发现在代码中,有数组越界的情况。因为定义的时候,数组的两个维度大小不一样,而在实
现 QWidget的重画事件时,因为坐标系的差别,使得两个维度的顺序对换,使得发生数组越界的情况。
详细解释:在程序中我定义的数组是QColor color [ Height ] [ Width ], 我的本意是Height代表图片的高度,Height的初值为400;Width
代表图片的高度,Width的初值为600。
然而在Qt的paintEvent事件中,QPainter中的 drawPoint( int x,int y )函数中,x表示的是图片的横坐标,对应数组的Width;
y表示图片的纵坐标,对应数组的Height。
由于在刚开始没有意识到坐标系与数组维度的对应关系,使得对应错误,导致越界。
如有疑问,请留言!如有问题,求指正!
[align=left] [/align]
起因:在代码中添加类型为QColor的二维数组,存储图片每个像素。
现象:调试时出现上图所示错误。
原因:经过百度以及反复查看代码,发现在代码中,有数组越界的情况。因为定义的时候,数组的两个维度大小不一样,而在实
现 QWidget的重画事件时,因为坐标系的差别,使得两个维度的顺序对换,使得发生数组越界的情况。
详细解释:在程序中我定义的数组是QColor color [ Height ] [ Width ], 我的本意是Height代表图片的高度,Height的初值为400;Width
代表图片的高度,Width的初值为600。
然而在Qt的paintEvent事件中,QPainter中的 drawPoint( int x,int y )函数中,x表示的是图片的横坐标,对应数组的Width;
y表示图片的纵坐标,对应数组的Height。
由于在刚开始没有意识到坐标系与数组维度的对应关系,使得对应错误,导致越界。
如有疑问,请留言!如有问题,求指正!
相关文章推荐
- 遇到"Unhandled exception in app.exe (QTGUID4.DLL): 0xC0000005: Access Violation"错误的解决过程
- 解决VC 类向导添加变量后莫名其妙出现 Unhandled exception in xxx.exe:0xC0000005:Access Violation错误的问题
- Unhandled exception at 0x007be7e0 in test.exe: 0xC0000005: Access violation writing location 0x00000
- Unhandled exception at 0x........ in XXXX.exe: 0xC0000005:Access violation reading location 0x......
- Unhandled exception at 0x008f9b82 in .exe: 0xC0000005: Access violation reading location 0x00000298.
- Unhandled exception at 0x00000000 in CallDll.exe: 0xC0000005: Access violation reading location 0x00
- Unhandled exception at 0x........ in XXXX.exe: 0xC0000005:Access violation reading location 0x......
- 生成成功,调试时出现错误导致中断Unhandled exception at 0x41cd7fb0 in webcam.exe: 0xC0000005: Access violatio
- Solve Error: Unhandled exception at 0x00905a4d in xxx.exe: 0xC0000005: Access violation.
- 就会报Unhandled exception at 0x1000a0ce (Libnet.dll) in tcp1.exe: 0xC0000005: Access violation reading location 0xfffffe64.错误。 请问为什
- Unhandled exception at 0x........ in XXXX.exe: 0xC0000005:错误
- First-chance exception at 0x774CEB23 (ntdll.dll) in XXX.exe: 0xC0000005: Access violation writing
- 关于出现Unhandled exception at 0x091f11c7 in ****: 0xC0000005: Access violation reading location 0x0ab0f
- Exception in thread "Thread-0" org.eclipse.swt.SWTException: Invalid thread access. 错误解决
- 对话框导入图片 出现unhandled exception in xxxexe 0xC0000005:Access Violation 错误
- unhandled exception in .exe :0xC0000005:Access Violation.
- First-chance exception in MFCDibImshow.exe: 0xC0000005: Access Violation.
- First-chance exception at 0x000007FE86D99B3C in XXXX.exe: 0xC0000005: Access violation reading locat
- Exception in thread "main" java.lang.LinkageError错误的解决
- 奇怪的 unhandled exception in 0xc0000005 *.exe: access violation 错误