Skip to content

Commit

Permalink
Pull over two fixes from FreeBSD
Browse files Browse the repository at this point in the history
SingleLock.h
Do not create copy of CCriticalSection for each CSingleLock instance

Use reference to CCriticalSection as a CSingleLock member. Otherwise
assignment operator just byte-copies content of CCriticalSection
and for each copy destructor will destroy mutex which may lead
to undefined behaviour

OMXThread.cpp
Fix order of operations on pthread attribute: init first, then modify

Bump PKGREVISION
  • Loading branch information
skrll committed Nov 13, 2015
1 parent e60fe40 commit cace866
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
4 changes: 2 additions & 2 deletions multimedia/omxplayer/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.4 2015/06/30 09:57:40 ryoon Exp $
# $NetBSD: Makefile,v 1.5 2015/11/13 15:12:15 skrll Exp $

DISTNAME= omxplayer-20150118
PKGREVISION= 3
PKGREVISION= 4
CATEGORIES= multimedia
MASTER_SITES= http://www.invisible.ca/packages/distfiles/
EXTRACT_SUFX= .zip
Expand Down
4 changes: 3 additions & 1 deletion multimedia/omxplayer/distinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.5 2015/11/03 23:54:31 agc Exp $
$NetBSD: distinfo,v 1.6 2015/11/13 15:12:15 skrll Exp $

SHA1 (omxplayer-20150118.zip) = 95522df16247bd1ece40cbccac05f9e73f1c1d2a
RMD160 (omxplayer-20150118.zip) = 0d3678c8ae71ed3ae507b7f0aaab2a482ee87691
Expand All @@ -9,5 +9,7 @@ SHA1 (patch-Keyboard.h) = 48d4b5da443b6a1e5b736907b9b660c1afb1f119
SHA1 (patch-Makefile) = fe45c59a7cb1282c48f16bd56be9f64422fa4bf2
SHA1 (patch-Makefile.include) = c78979b5b0e2d76f4e83f80bd6144d5b892eff34
SHA1 (patch-OMXControl.cpp) = 55e3e73b29c1e8cf1999271a0fbf298e3e0eaa8e
SHA1 (patch-OMXThread.cpp) = 9d5cd21fb0dc3881507f94ac7723a325877bf3d4
SHA1 (patch-linux_PlatformDefs.h) = 1918a2b87e33074a08cd36f3b932c8d6b3273457
SHA1 (patch-omxplayer.cpp) = 6746573a66ccdf6791afe3e38f07330d8444dd0b
SHA1 (patch-utils_SingleLock.h) = 34597e7196a4ab066ee9a4c9685a10fb75db7e36
14 changes: 14 additions & 0 deletions multimedia/omxplayer/patches/patch-OMXThread.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
$NetBSD: patch-OMXThread.cpp,v 1.1 2015/11/13 15:12:15 skrll Exp $

--- OMXThread.cpp.orig 2015-01-12 15:10:50.000000000 +0000
+++ OMXThread.cpp
@@ -41,8 +41,8 @@
OMXThread::OMXThread()
{
pthread_mutex_init(&m_lock, NULL);
- pthread_attr_setdetachstate(&m_tattr, PTHREAD_CREATE_JOINABLE);
pthread_attr_init(&m_tattr);
+ pthread_attr_setdetachstate(&m_tattr, PTHREAD_CREATE_JOINABLE);
m_thread = 0;
m_bStop = false;
m_running = false;
29 changes: 29 additions & 0 deletions multimedia/omxplayer/patches/patch-utils_SingleLock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$NetBSD: patch-utils_SingleLock.h,v 1.1 2015/11/13 15:12:15 skrll Exp $

--- utils/SingleLock.h.orig 2015-01-12 15:10:50.000000000 +0000
+++ utils/SingleLock.h
@@ -40,6 +40,10 @@ public:
inline void Lock() { pthread_mutex_lock(&m_lock); }
inline void Unlock() { pthread_mutex_unlock(&m_lock); }

+private:
+ CCriticalSection(CCriticalSection &other) = delete;
+ CCriticalSection& operator=(const CCriticalSection&) = delete;
+
protected:
pthread_mutex_t m_lock;
};
@@ -48,11 +52,11 @@ protected:
class CSingleLock
{
public:
- inline CSingleLock(CCriticalSection& cs) { m_section = cs; m_section.Lock(); }
+ inline CSingleLock(CCriticalSection& cs) : m_section(cs) { m_section.Lock(); }
inline ~CSingleLock() { m_section.Unlock(); }

protected:
- CCriticalSection m_section;
+ CCriticalSection &m_section;
};


0 comments on commit cace866

Please sign in to comment.