[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [phonon-gstreamer/1.0-porting-for-merge] gstreamer: Move Debug to Phonon::Gstreamer namespace to pre
From:       Dan_Vrátil <dvratil () redhat ! com>
Date:       2013-11-26 11:13:47
Message-ID: E1VlGaR-00042A-50 () scm ! kde ! org
[Download RAW message or body]

Git commit 8173a1bc5a34d1422a08e8949a5100549eb5890e by Dan Vrátil.
Committed on 26/11/2013 at 11:12.
Pushed by dvratil into branch '1.0-porting-for-merge'.

Move Debug to Phonon::Gstreamer namespace to prevent collision with Amarok

Both Amarok and us define "extern QMutex Debug::mutex". This works fine during
run time, but causes a double-free corruption when heap-allocations are being
free'd after main() returns.

libc will first destroy one mutex and then tries to free the other one, which
is however pointing to the same memory, because they are both 'extern'. As a
result, we get a double-free corruption.

By moving our Debug namespace into Phonon::Gstreamer namespace, we prevent
the collision and get no more crashes when quitting Amarok.

CCBUG: 320448

M  +4    -2    gstreamer/debug.cpp
M  +8    -0    gstreamer/debug.h

http://commits.kde.org/phonon-gstreamer/8173a1bc5a34d1422a08e8949a5100549eb5890e

diff --git a/gstreamer/debug.cpp b/gstreamer/debug.cpp
index 9515779..301f3cd 100644
--- a/gstreamer/debug.cpp
+++ b/gstreamer/debug.cpp
@@ -36,9 +36,11 @@
 
 #define DEBUG_INDENT_OBJECTNAME QLatin1String("Debug_Indent_object")
 
-QMutex Debug::mutex( QMutex::Recursive );
 
-using namespace Debug;
+QMutex Phonon::Gstreamer::Debug::mutex( QMutex::Recursive );
+
+using namespace Phonon::Gstreamer;
+using namespace Phonon::Gstreamer::Debug;
 
 static bool s_debugColorsEnabled = true;
 static DebugLevel s_debugLevel = DEBUG_NONE;
diff --git a/gstreamer/debug.h b/gstreamer/debug.h
index a0e4f71..213bf71 100644
--- a/gstreamer/debug.h
+++ b/gstreamer/debug.h
@@ -42,6 +42,10 @@
 #define __PRETTY_FUNCTION__ __FILE__
 #endif
 
+namespace Phonon {
+
+namespace Gstreamer {
+
 /**
  * @namespace Debug
  * @short kdebug with indentation functionality and convenience macros
@@ -197,4 +201,8 @@ namespace Debug
     typedef QList<QVariant> List;
 }
 
+} // namespace Gstreamer
+
+} // namespace Phonon
+
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic