Hi, I looked yesterday in kmix code and I see this, which I think is a bit wrong, or I do not understand why close() is called even if open fails - we just want to know if mixer is valid.
bool Mixer_Backend::isValid() { bool valid = false; int ret = open(); if ( ret == 0 && m_mixDevices.count() > 0) { valid = true; } close(); return valid; }
regards
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
On 2018/05/18 01:08 PM, deloptes wrote:
Hi, I looked yesterday in kmix code and I see this, which I think is a bit wrong, or I do not understand why close() is called even if open fails - we just want to know if mixer is valid.
bool Mixer_Backend::isValid() { bool valid = false; int ret = open(); if ( ret == 0 && m_mixDevices.count() > 0) { valid = true; } close(); return valid; }
regards
The code makes sense to me at a very superficial sight. open() may succeed but the "if" could fail is m_mixDevices.count() is <=0. So calling close() even if the "if" fails makes sense, as long as close() does nothing wrong if open() had previously failed.
Cheers Michele