These could lead to race conditions, and are removed from Qt5.
---
 phonon/globalstatic_p.h |    8 +++-----
 1 fil ändrad, 3 tillägg(+), 5 borttagningar(-)

diff --git a/phonon/globalstatic_p.h b/phonon/globalstatic_p.h
index cf80512..7555630 100644
--- a/phonon/globalstatic_p.h
+++ b/phonon/globalstatic_p.h
@@ -260,7 +260,7 @@ static struct PHONON_GLOBAL_STATIC_STRUCT_NAME(NAME)
     }                                                                          
\
     inline TYPE *operator->()                                                  
\
     {                                                                          
\
-        TYPE *p = _k_static_##NAME;                                            
\
+        TYPE *p = _k_static_##NAME.fetchAndAddAcquire(0);                      
\
         if (!p) {                                                              
\
             if (isDestroyed()) {                                               
\
                 qFatal("Fatal Error: Accessed global static '%s *%s()' after 
destruction. " \
@@ -269,7 +269,7 @@ static struct PHONON_GLOBAL_STATIC_STRUCT_NAME(NAME)
             p = new TYPE ARGS;                                                 
\
             if (!_k_static_##NAME.testAndSetOrdered(0, p)) {                   
\
                 delete p;                                                      
\
-                p = _k_static_##NAME;                                          
\
+                p = _k_static_##NAME.fetchAndAddAcquire(0);                    
\
             } else {                                                           
\
                 static Phonon::CleanUpGlobalStatic cleanUpObject = { destroy 
}; \
             }                                                                  
\
@@ -283,9 +283,7 @@ static struct PHONON_GLOBAL_STATIC_STRUCT_NAME(NAME)
     static void destroy()                                                      
\
     {                                                                          
\
         _k_static_##NAME##_destroyed = true;                                   
\
-        TYPE *x = _k_static_##NAME;                                            
\
-        _k_static_##NAME = 0;                                                  
\
-        delete x;                                                              
\
+        delete _k_static_##NAME.fetchAndStoreRelease(0);                       
\
     }                                                                          
\
 } NAME;
 
-- 
1.7.10.4

_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel

Reply via email to