kaffeine/mutex.diff

63 lines
1.6 KiB
Diff

--- kaffeine/src/player-parts/xine-part/kxinewidget.cpp
+++ kaffeine/src/player-parts/xine-part/kxinewidget.cpp
@@ -380,12 +380,13 @@
{
debugOut("xine event: channels changed");
int i,channels;
- char* lang = new char[128];
+ char lang[128];
QString slang;
int num;
QStringList tmp;
bool update=false, sk;
+ vw->m_mutex.lock();
/*** get audio channels ***/
tmp.append(i18n("auto"));
channels = xine_get_stream_info(vw->m_xineStream, XINE_STREAM_INFO_MAX_AUDIO_CHANNEL);
@@ -433,8 +434,6 @@
vw->m_currentSub = num;
}
- delete [] lang;
-
//check if stream is seekable
sk = (bool)xine_get_stream_info(vw->m_xineStream, XINE_STREAM_INFO_SEEKABLE);
if ( vw->m_trackIsSeekable!=sk ) {
@@ -442,6 +441,7 @@
vw->m_trackIsSeekable = sk;
}
+ vw->m_mutex.unlock();
if ( update )
QApplication::postEvent(vw, new QTimerEvent(TIMER_EVENT_NEW_CHANNELS));
break;
@@ -705,7 +705,9 @@
}
case TIMER_EVENT_NEW_CHANNELS:
{
+ m_mutex.lock();
emit signalNewChannels(m_audioCh, m_subCh, m_currentAudio, m_currentSub);
+ m_mutex.unlock();
break;
}
case TIMER_EVENT_NEW_TITLE:
--- kaffeine/src/player-parts/xine-part/kxinewidget.h
+++ kaffeine/src/player-parts/xine-part/kxinewidget.h
@@ -47,6 +47,7 @@
class QTime;
#include <qtimer.h>
+#include <qmutex.h>
#include <qptrlist.h>
#include <qthread.h>
#include <X11/Xlib.h>
@@ -485,6 +486,7 @@
bool m_trackHasAudio;
bool m_trackHasChapters;
bool m_trackIsSeekable;
+ QMutex m_mutex;
/* dvb */
signals: