-----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 -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEjhl1z5vbYB3YbFTiKnW3yore1c8FAlsFywgACgkQKnW3yore 1c+NpRAArzMOLUghsm1kUB0L/d6c432xZimMvvT6tQ84bR/PZQVVy5vxsoJByN2F aGAMTOvKvJ2oy5UM6jtDByqGO0QTLsYSryLKy8vm0y3lbLBL4fCQA3fuLjUrrF69 jOQgBrU8hnWAxrC5hh42xz1Zg+WOKDHdTauUiIA1ZKdfUo1uPubdrsAx6Xx/8z0U LUVn2prX+mDbJL71nwZ+NyZAKdhW71W+6yd83yJPCziOWRttlko8Wuu/eWKla1XN zRm+uV2vNFqoNieozjV5hTWtr6hK+CH2m08mW5YYvFIJQLNDqh2Ht8IqXFmU64mS DxP7rI19Tili0Y4wjpEPaZGKIjSWo/WDMmGfT5QDYN9o9HIUY35OGGzDJe1ACcEd s6bggMPd5+v0SvhOFFPv8tLDF/GEGbzXr2QjerwombADyexuvYK3YUlDuPwCIp7a oKYZHRrUXSF+QNGQmUj76jEJYjcNlCWn/AEQT2fmzOxWFqYRFRUBv4Jsgd72TzuP rwsSxEMSxvEbEwlvvx6w8sZDIRpK8aJKeO6SFpOOk2hH8ne/eTyfdn7WqlKx680I p1fmpoBlxcLkXHdP8fGea5NtXINWkz/8b+gotb4drYecO/RO5qq6l/5NThYEnVBs r1h25LeCs0HTnZqFwofb1qtQG2uLa1G4SFqPXuW13k2vSAKyzd4= =FPqK -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: trinity-devel-unsubscribe@xxxxxxxxxxxxxxxxxxxxxxxxxx For additional commands, e-mail: trinity-devel-help@xxxxxxxxxxxxxxxxxxxxxxxxxx Read list messages on the web archive: http://trinity-devel.pearsoncomputing.net/ Please remember not to top-post: http://trinity.pearsoncomputing.net/mailing_lists/#top-posting