[mythtv] Shoutcast patch ; updated for svn 16380.
Zdzislaw Gorlicki
zdzisekg at comcast.net
Thu Mar 13 04:48:08 UTC 2008
Steven Adeff wrote:
> On Tue, Mar 11, 2008 at 1:51 AM, Zdzislaw Gorlicki <zdzisekg at comcast.net> wrote:
> <snip>
>
>> I tried to send a manually corrected patch, but I guess it was too big
>> for the mailing list. To resolve the failed hunk make the
>> mythobservable.cpp portion of the patch look like this:
>>
> <snip>
>
> Tried to apply your adjustment to 16517 and still got:
> patching file mythtv/libs/libmyth/mythobservable.cpp
> Hunk #1 FAILED at 12.
> 1 out of 1 hunk FAILED -- saving rejects to file
> mythtv/libs/libmyth/mythobservable.cpp.rej
>
> here's what the rej file shows:
> $ more mythtv/libs/libmyth/mythobservable.cpp.rej
> ***************
> *** 12,59 ****
>
> void MythObservable::addListener(QObject *listener)
> {
> if (m_listeners.find(listener) == -1)
> m_listeners.append(listener);
> }
>
> void MythObservable::removeListener(QObject *listener)
> {
> if (m_listeners.find(listener) != -1)
> m_listeners.remove(listener);
> }
>
> - QObject* MythObservable::firstListener()
> - {
> - return m_listeners.first();
> - }
> -
> - QObject* MythObservable::nextListener()
> - {
> - return m_listeners.next();
> - }
> -
> QPtrList<QObject> MythObservable::getListeners()
> {
> return m_listeners;
> }
>
> void MythObservable::dispatch(MythEvent &event)
> {
> - QObject *listener = firstListener();
> - while (listener)
> {
> QApplication::postEvent(listener, event.clone());
> - listener = nextListener();
> }
> }
>
> void MythObservable::dispatchNow(MythEvent &event)
> {
> - QObject *listener = firstListener();
> - while (listener)
> {
> QApplication::sendEvent(listener, event.clone());
> - listener = nextListener();
> }
> }
>
> --- 12,66 ----
>
> void MythObservable::addListener(QObject *listener)
> {
> + QMutexLocker locked(&m_mutex);
> if (m_listeners.find(listener) == -1)
> m_listeners.append(listener);
> }
>
> void MythObservable::removeListener(QObject *listener)
> {
> + QMutexLocker locked(&m_mutex);
> if (m_listeners.find(listener) != -1)
> m_listeners.remove(listener);
> }
>
> QPtrList<QObject> MythObservable::getListeners()
> {
> + QMutexLocker locked(&m_mutex);
> return m_listeners;
> }
>
> void MythObservable::dispatch(MythEvent &event)
> {
> + // Copy the list and iterate on the copy, in case another thread
> + // modifies the list.
> +
> + m_mutex.lock ();
> + QPtrList<QObject> listeners(m_listeners);
> + m_mutex.unlock ();
> +
> + QPtrListIterator<QObject> it (listeners);
> + while (class QObject *listener = it.current ())
> {
> QApplication::postEvent(listener, event.clone());
> + ++it;
> }
> }
>
> void MythObservable::dispatchNow(MythEvent &event)
> {
> + // Copy the list and iterate on the copy, in case another thread
> + // modifies the list.
> +
> + m_mutex.lock ();
> + QPtrList<QObject> listeners(m_listeners);
> + m_mutex.unlock ();
> +
> + QPtrListIterator<QObject> it (listeners);
> + while (class QObject *listener = it.current ())
> {
> QApplication::sendEvent(listener, event.clone());
> + ++it;
> }
> }
>
>
try this
http://home.comcast.net/~zdzisekg/download/shoutcast-16380.patch
More information about the mythtv-dev
mailing list