summaryrefslogtreecommitdiffstats
path: root/kmix/mixer.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2020-08-10 17:25:51 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2020-08-28 17:50:37 +0900
commit337b217e9969813c0d6da8a7edd7847972e38927 (patch)
treeb1dbff0ecab2104cc194a46f51234e8ab0915940 /kmix/mixer.cpp
parented09d89f42d56059ba2cf3f6a328fe28ddfb78b1 (diff)
downloadtdemultimedia-337b217e9969813c0d6da8a7edd7847972e38927.tar.gz
tdemultimedia-337b217e9969813c0d6da8a7edd7847972e38927.zip
kmix: improve detection of mixers (invalid mixers are no longer created and destroyed) and fix memory leak in case of detection of mixers that were already existing.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'kmix/mixer.cpp')
-rw-r--r--kmix/mixer.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/kmix/mixer.cpp b/kmix/mixer.cpp
index 150b196d..62b6430a 100644
--- a/kmix/mixer.cpp
+++ b/kmix/mixer.cpp
@@ -72,6 +72,19 @@ TQPtrList<Mixer>& Mixer::mixers()
return s_mixers;
}
+bool Mixer::isValid(int driver, int device)
+{
+ getMixerFunc *mf = g_mixerFactories[driver].getMixer;
+ if (mf)
+ {
+ Mixer_Backend *mb = mf(device);
+ if (mb)
+ {
+ return mb->isValid();
+ }
+ }
+ return false;
+}
Mixer::Mixer( int driver, int device ) : DCOPObject( "Mixer" )
{
@@ -101,7 +114,6 @@ Mixer::Mixer( int driver, int device ) : DCOPObject( "Mixer" )
#endif
objid.prepend("Mixer");
DCOPObject::setObjId( objid );
-
}
Mixer::~Mixer() {