Fix #805 by resetting selected device on failure
authorSoeren Apel <soeren@apelpie.net>
Wed, 22 Jun 2016 16:02:34 +0000 (18:02 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Fri, 24 Jun 2016 21:15:39 +0000 (23:15 +0200)
commit7e0c99bf95836c89574b53ae3fa7840e2ddca77d
treec1066e3539fe412b38453984c66f0e2186fbac1d
parent2b05d3110a0a50ce93c8c887a2dc00c1375e92fa
Fix #805 by resetting selected device on failure

It can happen that devices can be selected but not used
(permissions problems, connection issues, driver issues, etc.),
so in those cases we want to fail gracefully instead of
segfaulting.
The reason for the segfault is the device selector button
isn't reset in case the device couldn't be opened, causing
the rest of the application to try and work with a device
instance that is actually invalid.

Resetting the device selector when the device failed to
open not only fixes this but also makes the UI more
consistent with the internal state.
pv/mainwindow.cpp
pv/session.cpp
pv/toolbars/mainbar.cpp
pv/toolbars/mainbar.hpp
pv/widgets/devicetoolbutton.cpp
pv/widgets/devicetoolbutton.hpp