Commit 08d013a4 authored by Dmitry Smirnov's avatar Dmitry Smirnov

new upstream patch: "upstream-use-QAtomicInt.patch"

parent 01f912e8
......@@ -3,5 +3,6 @@ postgresql9.4.patch
upstream-fix_typo_in_if_condition.patch
upstream-fix_buffer_overflow_in_AKTEST_FAKESERVER_MAIN.patch
upstream-do_not_crash_when_setmntent_returns_NULL.patch
upstream-use-QAtomicInt.patch
upstream_dont_call_insert_from_Q_ASSERT.patch
upstream_dont_leak_old_external_payload_files.patch
From 8a113985cda1693c8158916065bd54e57d028cda Mon Sep 17 00:00:00 2001
From: Milian Wolff <mail@milianw.de>
Date: Mon, 1 Dec 2014 11:39:33 +0100
Subject: [PATCH] Use an QAtomicInt instead of a plain bool for
Entity::cacheEnabled.
A plain bool is not thread safe and leads to undefined behavior.
So better be safe than sorry and use a thread safe QAtomicInt.
---
server/src/storage/entities-source.xsl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/src/storage/entities-source.xsl b/server/src/storage/entities-source.xsl
index 05a8cb1..e398da5 100644
--- a/server/src/storage/entities-source.xsl
+++ b/server/src/storage/entities-source.xsl
@@ -99,7 +99,7 @@ class <xsl:value-of select="$className"/>::Private : public QSharedData
static void addToCache( const <xsl:value-of select="$className"/> &amp; entry );
// cache
- static bool cacheEnabled;
+ static QAtomicInt cacheEnabled;
static QMutex cacheMutex;
<xsl:if test="column[@name = 'id']">
static QHash&lt;qint64, <xsl:value-of select="$className"/> &gt; idCache;
@@ -111,7 +111,7 @@ class <xsl:value-of select="$className"/>::Private : public QSharedData
// static members
-bool <xsl:value-of select="$className"/>::Private::cacheEnabled = false;
+QAtomicInt <xsl:value-of select="$className"/>::Private::cacheEnabled(0);
QMutex <xsl:value-of select="$className"/>::Private::cacheMutex;
<xsl:if test="column[@name = 'id']">
QHash&lt;qint64, <xsl:value-of select="$className"/> &gt; <xsl:value-of select="$className"/>::Private::idCache;
--
2.1.4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment