kaffeine/mutex.diff

59 lines
1.5 KiB
Diff

--- kaffeine/src/player-parts/xine-part/kxinewidget.cpp
+++ kaffeine/src/player-parts/xine-part/kxinewidget.cpp
@@ -395,9 +395,10 @@
{
debugOut("xine event: channels changed");
int i,j,channels;
- char* lang = new char[128];
+ char lang[128];
QString num;
+ vw->m_mutex.lock();
vw->m_audioCh.clear();
vw->m_audioCh.append(i18n("auto"));
vw->m_subCh.clear();
@@ -424,8 +425,6 @@
vw->m_subCh << i18n("Ch ") + num.setNum(j+1);
}
- delete [] lang;
-
vw->m_currentAudio = xine_get_param(vw->m_xineStream, XINE_PARAM_AUDIO_CHANNEL_LOGICAL) + 1;
vw->m_currentSub = xine_get_param(vw->m_xineStream, XINE_PARAM_SPU_CHANNEL) + 1;
@@ -444,6 +443,7 @@
//check if stream is seekable
vw->m_trackIsSeekable = (bool)xine_get_stream_info(vw->m_xineStream, XINE_STREAM_INFO_SEEKABLE);
+ vw->m_mutex.unlock();
QApplication::postEvent(vw, new QTimerEvent(TIMER_EVENT_NEW_CHANNELS));
break;
}
@@ -701,7 +701,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,5 +47,6 @@
#include <qtimer.h>
+#include <qmutex.h>
#include <qptrlist.h>
#include <X11/Xlib.h>
#include <xine.h>
@@ -441,6 +442,7 @@
bool m_trackHasAudio;
bool m_trackHasChapters;
bool m_trackIsSeekable;
+ QMutex m_mutex;
/* dvb */
signals: