Camera preview is normal. After you click "exit" or close the running form, a bunch of warnings will pop up in the compiler output column below, as shown below:
* ** Glibc detected ***/home/Yan/QT/Camera_Read_OpenCv_V1-build-desktop-Desktop_Qt_4_8_0_for_GCC _ qt_sdk ____/camera_read_opencv_v1: Free (): Invalid Pointer: 0xafeff000 ***
======= Backtrace: ============
/Lib/i386-linux-gnu/libc. so.6 (+ 0x6ebc2) [0x908bc2]
/Lib/i386-linux-gnu/libc. so.6 (+ 0x6f862) [0x909862]
/Lib/i386-linux-gnu/libc. so.6 (cfree + 0x6d) [0x90c94d]
/Usr/lib/libcxcore. so.2.1 (_ zn2cv8fastfreeepv + 0x23) [0xe236a3]
/Usr/lib/libcxcore. so.2.1 (cvfree _ + 0x1c) [0xe23c2c]
/Usr/lib/libcxcore. so.2.1 (cvreleaseimageheader + 0x6a) [0xe5b7ba]
/Usr/lib/libcxcore. so.2.1 (cvreleaseimage + 0x3f) [0xe5b8ff]
/Home/Yan/QT/Camera_Read_OpenCv_V1-build-desktop-Desktop_Qt_4_8_0_for_GCC _ qt_sdk ____/camera_read_opencv_v1 [0x804a679]
/Home/Yan/QT/Camera_Read_OpenCv_V1-build-desktop-Desktop_Qt_4_8_0_for_GCC _ qt_sdk ____/camera_read_opencv_v1 [0x804a1f3]
/Lib/i386-linux-gnu/libc. so.6 (_ libc_start_main + 0xf3) [0x8b3113]
/Home/Yan/QT/Camera_Read_OpenCv_V1-build-desktop-Desktop_Qt_4_8_0_for_GCC _ qt_sdk ____/camera_read_opencv_v1 [0x804a249]
======= Memory map: ========
0011316-003f1000 R-XP 00000000 557615/home/Yan/qtsdk/desktop/QT/4.8.0/GCC/lib/libqtcore. so.4.8.0
003f1000-003f8000 r -- p 002e0000 08:01 557615/home/Yan/qtsdk/desktop/QT/4.8.0/GCC/lib/libqtcore. so.4.8.0
003f8000-003fb000 RW-P 002e7000 08:01 557615/home/Yan/qtsdk/desktop/QT/4.8.0/GCC/lib/libqtcore. so.4.8.0
003fb000-000000000 R-XP 00000000 394171/lib/i386-linux-gnu/libgcc_s.so.1
00417000-00418000 r -- p 0001b000 08:01 394171/lib/i386-linux-gnu/libgcc_s.so.1 ............... And so on
Cause: In the camerawidget destructor, the sequence of release pointers is incorrect. It should be cvreleasecapture (& capture), and then cvreleaseimage (& IMG );
Note: IMG = cvqueryframe (capture ). If the memory release order is reversed, the above warning will appear!