[Marble-devel] [marble] src/lib/geodata/data: Remove the mutex attribute.

Dennis Nienhüser earthwings at gentoo.org
Tue Apr 24 11:00:14 UTC 2012


Git commit 752d15b0e539ff99adec4f5edcee118a69e55b56 by Dennis Nienhüser.
Committed on 24/04/2012 at 12:57.
Pushed by nienhueser into branch 'master'.

Remove the mutex attribute.

Geodata objects are not thread-safe by itself, so the problem this
part of the code was solving should be handled elsewhere. From my
tests everything works still fine without the mutex.

This should solve the problem of creating a huge amount of handles
on Windows, reported by Konrad Enzensberger - thanks for reporting
and tracking it down!.

Please test.
CCMAIL: marble-devel at kde.org

M  +0    -6    src/lib/geodata/data/GeoDataRegion.cpp
M  +0    -7    src/lib/geodata/data/GeoDataRegion_p.h

http://commits.kde.org/marble/752d15b0e539ff99adec4f5edcee118a69e55b56

diff --git a/src/lib/geodata/data/GeoDataRegion.cpp b/src/lib/geodata/data/GeoDataRegion.cpp
index d8dbe5a..066f5ab 100644
--- a/src/lib/geodata/data/GeoDataRegion.cpp
+++ b/src/lib/geodata/data/GeoDataRegion.cpp
@@ -61,7 +61,6 @@ const char* GeoDataRegion::nodeType() const
 
 GeoDataLatLonAltBox& GeoDataRegion::latLonAltBox() const
 {
-    QMutexLocker locker( &d->m_mutex );
     // FIXME: This isn't exactly what a 'const' function should do, is it?
 
     // If the latLonAltBox hasn't been set try to determine it automatically
@@ -100,7 +99,6 @@ GeoDataLatLonAltBox& GeoDataRegion::latLonAltBox() const
 
 void GeoDataRegion::setLatLonAltBox( const GeoDataLatLonAltBox & latLonAltBox )
 {
-    QMutexLocker locker( &d->m_mutex );
     delete d->m_latLonAltBox;
     d->m_latLonAltBox = new GeoDataLatLonAltBox( latLonAltBox );
 }
@@ -108,7 +106,6 @@ void GeoDataRegion::setLatLonAltBox( const GeoDataLatLonAltBox & latLonAltBox )
 
 GeoDataLod& GeoDataRegion::lod() const
 {
-    QMutexLocker locker( &d->m_mutex );
     // If the lod hasn't been set then return a shared one
     if ( !d->m_lod ) {
         // FIXME: reference a shared object instead
@@ -121,7 +118,6 @@ GeoDataLod& GeoDataRegion::lod() const
 
 void GeoDataRegion::setLod( const GeoDataLod & lod )
 {
-    QMutexLocker locker( &d->m_mutex );
     delete d->m_lod;
     d->m_lod = new GeoDataLod( lod );
 }
@@ -149,9 +145,7 @@ GeoDataRegion &GeoDataRegion::operator=( const GeoDataRegion& other )
     // Self assignment
     if ( this == &other ) return *this;
 
-    other.d->m_mutex.lock();
     GeoDataRegion temp( other );
-    other.d->m_mutex.unlock();
     swap( temp );
     return *this;
 }
diff --git a/src/lib/geodata/data/GeoDataRegion_p.h b/src/lib/geodata/data/GeoDataRegion_p.h
index 1ac56fe..f3a8069 100644
--- a/src/lib/geodata/data/GeoDataRegion_p.h
+++ b/src/lib/geodata/data/GeoDataRegion_p.h
@@ -15,10 +15,6 @@
 
 #include "GeoDataTypes.h"
 
-//Qt
-#include <QtCore/QMutex>
-#include <QtCore/QMutexLocker>
-
 namespace Marble
 {
 
@@ -60,7 +56,6 @@ class GeoDataRegionPrivate
 
     ~GeoDataRegionPrivate()
     {
-        QMutexLocker locker( &m_mutex );
         delete m_latLonAltBox;
         delete m_lod;
     }
@@ -75,8 +70,6 @@ class GeoDataRegionPrivate
     GeoDataLatLonAltBox * m_latLonAltBox;
     GeoDataLod * m_lod;
 
-    QMutex m_mutex;
-
   private:
     // Preventing usage of operator=
     GeoDataRegionPrivate &operator=( const GeoDataRegionPrivate& );


More information about the Marble-devel mailing list