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

List:       kde-commits
Subject:    KDE/kdelibs/nepomuk/core
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2010-12-08 14:17:31
Message-ID: 20101208141731.55EE0AC8A7 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1204648 by trueg:

Protect everything via the ResourceManager mutex.

 M  +3 -1      resource.cpp  
 M  +1 -5      resourcedata.h  


--- trunk/KDE/kdelibs/nepomuk/core/resource.cpp #1204647:1204648
@@ -1,6 +1,6 @@
 /*
  * This file is part of the Nepomuk KDE project.
- * Copyright (C) 2006-2009 Sebastian Trueg <trueg@kde.org>
+ * Copyright (C) 2006-2010 Sebastian Trueg <trueg@kde.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -65,6 +65,7 @@
 
 Nepomuk::Resource::Resource( const Nepomuk::Resource& res )
 {
+    QMutexLocker lock( &res.m_data->rm()->mutex );
     m_data = res.m_data;
     if ( m_data )
         m_data->ref( this );
@@ -120,6 +121,7 @@
 
 Nepomuk::Resource::Resource( Nepomuk::ResourceData* data )
 {
+    QMutexLocker lock( &data->rm()->mutex );
     m_data = data;
     if ( m_data )
         m_data->ref( this );
--- trunk/KDE/kdelibs/nepomuk/core/resourcedata.h #1204647:1204648
@@ -1,6 +1,6 @@
 /*
  * This file is part of the Nepomuk KDE project.
- * Copyright (C) 2006-2009 Sebastian Trueg <trueg@kde.org>
+ * Copyright (C) 2006-2010 Sebastian Trueg <trueg@kde.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -48,14 +48,12 @@
         ~ResourceData();
 
         inline bool ref(Nepomuk::Resource* res) {
-            QMutexLocker lock(&m_resourcesMutex);
             m_resources.push_back( res );
             return m_ref.ref();
         }
 
 
         inline bool deref(Nepomuk::Resource* res) {
-            QMutexLocker lock(&m_resourcesMutex);
             m_resources.removeAll( res );
             return m_ref.deref();
         }
@@ -201,8 +199,6 @@
 
         mutable QMutex m_modificationMutex;
 
-        QMutex m_resourcesMutex;
-
         QHash<QUrl, Variant> m_cache;
         bool m_cacheDirty;
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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