qv4l2: fix segmentation fault when compiled without ALSA support.
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 3 Jun 2014 09:04:16 +0000 (11:04 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Tue, 3 Jun 2014 09:04:16 +0000 (11:04 +0200)
If opening the video device fails, then qv4l2 attempts to disable
two alsa widgets. If qv4l2 was compiled without alsa support, then
those widget pointers are NULL and you get a segfault.

Add the proper #ifdef so this is only done if alsa support was
compiled in.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/qv4l2/qv4l2.cpp

index bcce927..5f26ff4 100644 (file)
@@ -208,8 +208,10 @@ void ApplicationWindow::setDevice(const QString &device, bool rawOpen)
        connect(m_sigMapper, SIGNAL(mapped(int)), this, SLOT(ctrlAction(int)));
 
        if (!open(device, !rawOpen)) {
+#ifdef HAVE_ALSA
                m_showAllAudioAct->setEnabled(false);
                m_audioBufferAct->setEnabled(false);
+#endif
                return;
        }