The camera preview is normal, when you click the "Exit button", or when you close the running form, the following compiler output bar pops up with a bunch of warnings, as follows:
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: ========
00110000-003f1000 R-xp 00000000 08:01 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-00417000 R-xp 00000000 08:01 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 ........ Wait a lot.
Cause: In the destructor of Camerawidget, the order of releasing the pointer is not correct, it should be cvreleasecapture (&capture), then Cvreleaseimage (&img);
Remark: img = cvqueryframe (capture). This warning occurs if the memory release order is reversed.