[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-multimedia
Subject:    PATCH: Less crashes, emit soundserverDied() signal instead
From:       Nikolas Zimmermann <wildfox () kde ! org>
Date:       2001-07-12 10:01:43
[Download RAW message or body]

Hi guys,

please review.

Comments?

Bye
 Bye
  Niko

-- 
Nikolas Zimmermann
wildfox@kde.org
["artskde.diff" (text/x-diff)]

Index: kplayobject.cc
===================================================================
RCS file: /home/kde/kdelibs/arts/kde/kplayobject.cc,v
retrieving revision 1.13
diff -u -p -b -r1.13 kplayobject.cc
--- kplayobject.cc	2001/05/19 22:34:12	1.13
+++ kplayobject.cc	2001/07/12 10:11:12
@@ -42,11 +42,23 @@ KPlayObject::~KPlayObject()
 
 void KPlayObject::play()
 {
+	if(isNull())
+	{
+		emit soundserverDied();
+		return;
+	}
+
 	object().play();
 }
 
 void KPlayObject::seek(Arts::poTime newTime)
 {
+	if(isNull())
+	{
+		emit soundserverDied();
+		return;
+	}
+	
 	if(!m_isStream)
 		object().seek(newTime);
 	else
@@ -55,41 +67,93 @@ void KPlayObject::seek(Arts::poTime newT
 
 void KPlayObject::pause()
 {
+	if(isNull())
+	{
+		emit soundserverDied();
+		return;
+	}
+
 	object().pause();
 }
 
 void KPlayObject::halt()
 {
+	if(isNull())
+	{
+		emit soundserverDied();
+		return;
+	}
+
 	object().halt();
 }
 
 QString KPlayObject::description()
 {
+	if(isNull())
+	{
+		emit soundserverDied();
+		return QString::null;
+	}
+
 	return QString::fromLatin1(object().description().c_str());
 }
 
 Arts::poTime KPlayObject::currentTime()
 {
+	if(isNull())
+	{
+		emit soundserverDied();
+		Arts::poTime time;
+		return time;
+	}
+
 	return object().currentTime();
 }
 
 Arts::poTime KPlayObject::overallTime()
 {
+	if(isNull())
+	{
+		emit soundserverDied();
+		Arts::poTime time;
+		return time;
+	}
+
 	return object().overallTime();
 }
 
 Arts::poCapabilities KPlayObject::capabilities()
 {
+	if(isNull())
+	{
+		emit soundserverDied();
+		Arts::poCapabilities cap;
+		return cap;
+	}
+
 	return object().capabilities();
 }
 
 QString KPlayObject::mediaName()
 {
+	if(isNull())
+	{
+		emit soundserverDied();
+		return QString::null;
+	}
+
 	return QString::fromLatin1(object().mediaName().c_str());
 }
 
 Arts::poState KPlayObject::state()
 {
+	if(isNull())
+	{
+		emit soundserverDied();
+		Arts::poState state;
+		return state;
+	}
+
 	return object().state();
 }
 
Index: kplayobject.h
===================================================================
RCS file: /home/kde/kdelibs/arts/kde/kplayobject.h,v
retrieving revision 1.9
diff -u -p -b -r1.9 kplayobject.h
--- kplayobject.h	2001/05/19 20:55:58	1.9
+++ kplayobject.h	2001/07/12 10:11:12
@@ -45,10 +45,7 @@ public:
 	Arts::PlayObject object();
 
 	/**
-	 * return true if both this != 0, and object.isNull()
-	 *
-	 * in essence, ((KPlayObject*)0)->isNull() will not 
-	 * crash
+	 * returns object.isNull()
 	 **/
 	bool isNull();
 
@@ -109,6 +106,9 @@ public:
 	 */
 	Arts::poState state();
 
+signals:
+	void soundserverDied();
+	
 private:
 	Arts::PlayObject m_playObject;
 	bool m_isStream;

_______________________________________________
Kde-multimedia mailing list
Kde-multimedia@master.kde.org
http://master.kde.org/mailman/listinfo/kde-multimedia


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic