I received this report via the Debian bug tracking system:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=374814

It seems that when lirc is installed, but there is no valid lirc config
found, rosegarden dies.

It seems like it would be better if instead, rosegarden would just
continue with a warning.

Attached is a patch which attempts to do this.

Thanks!
stew

diff -urNad rosegarden-1.2.3~/gui/lircclient.cpp rosegarden-1.2.3/gui/lircclient.cpp
--- rosegarden-1.2.3~/gui/lircclient.cpp	2006-01-03 15:14:34.000000000 -0500
+++ rosegarden-1.2.3/gui/lircclient.cpp	2006-07-23 01:43:22.000000000 -0400
@@ -40,7 +40,7 @@
 
 // constructor/destructor initializes the LircClient library
 LircClient::LircClient(void)
-    : QObject()
+    : QObject(), m_available(false)
 {   
     int socketFlags;
 
@@ -57,12 +57,18 @@
         fcntl(socketFlags, F_SETFL, socketFlags|O_NONBLOCK);
     }    
     
-    if(lirc_readconfig(NULL, &m_config, NULL)==-1) exit(EXIT_FAILURE);
-    
-    m_socketNotifier = new QSocketNotifier(m_socket, QSocketNotifier::Read, 0);
-    connect(m_socketNotifier, SIGNAL(activated(int)), this, SLOT(readButton()) );
-        
-    RG_DEBUG << "LircClient::LircClient: connected to socket: " << m_socket << endl;
+    if(lirc_readconfig(NULL, &m_config, NULL)!=-1)
+    {
+	m_socketNotifier = new QSocketNotifier(m_socket, QSocketNotifier::Read, 0);
+	connect(m_socketNotifier, SIGNAL(activated(int)), this, SLOT(readButton()) );
+
+	m_available = true;
+	RG_DEBUG << "LircClient::LircClient: connected to socket: " << m_socket << endl;
+    }
+    else
+    {
+	RG_DEBUG << "LircClient::LircClient: lirc config missing.  lirc support will be disabled.";
+    }
 }
 
 LircClient::~LircClient()
diff -urNad rosegarden-1.2.3~/gui/lircclient.h rosegarden-1.2.3/gui/lircclient.h
--- rosegarden-1.2.3~/gui/lircclient.h	2006-01-03 15:14:34.000000000 -0500
+++ rosegarden-1.2.3/gui/lircclient.h	2006-07-23 01:44:13.000000000 -0400
@@ -47,12 +47,14 @@
     
 public slots:
     void readButton();
+    bool getAvailable() { return m_available; }
     
 signals:
     void buttonPressed(char *);
         
 private:
     int                 m_socket;
+    bool                m_available;
     QSocketNotifier     *m_socketNotifier;
     struct lirc_config  *m_config;
     char                *m_command;
diff -urNad rosegarden-1.2.3~/gui/lirccommander.cpp rosegarden-1.2.3/gui/lirccommander.cpp
--- rosegarden-1.2.3~/gui/lirccommander.cpp	2006-01-03 15:14:34.000000000 -0500
+++ rosegarden-1.2.3/gui/lirccommander.cpp	2006-07-23 02:00:35.000000000 -0400
@@ -39,7 +39,9 @@
 {
     m_lirc = lirc;
     m_rgGUIApp = rgGUIApp;
-    connect(m_lirc, SIGNAL(buttonPressed(char *)), this, SLOT(execute(char *)) );
+    
+    if(m_lirc && m_lirc->getAvailable() )
+	connect(m_lirc, SIGNAL(buttonPressed(char *)), this, SLOT(execute(char *)) );
 } 
 
 
diff -urNad rosegarden-1.2.3~/version.txt rosegarden-1.2.3/version.txt
--- rosegarden-1.2.3~/version.txt	1969-12-31 19:00:00.000000000 -0500
+++ rosegarden-1.2.3/version.txt	2006-07-23 02:14:50.000000000 -0400
@@ -0,0 +1 @@
+4-1.2.3
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to