summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qrefcount.h
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-07-15 17:51:07 +0200
committerQt by Nokia <qt-info@nokia.com>2011-07-15 18:46:50 +0200
commit6c984d6c15a0b0a210aac12513217fc08437c690 (patch)
tree1956df0a8afadd40cd06600a2fd81a473d44f9f1 /src/corelib/tools/qrefcount.h
parentb1a0f7c0d23fb303b00265bb2c5615990f909f98 (diff)
"Fix" the crash at startup on MSVC
The problem is that for some reasons, QByteArray::shared_null (and probably shared_empty, and the ones for QString) are not in the .rodata anymore, and they are initialized by code. programs like QMake, which has others global objects (like global QFiles) that uses QByteArray crashes, because they reference and dereference shared_null (and try to destroy shared_null) That happens before shared_null's refcount is initialized to -1 The solution here is not to ref() the objects that have a refcount of 0 (that is what the refcount is before it is initialized to -1) The real fix to this problem would be to understand why it is not in the proper section, and make sure it is. Change-Id: I5b7e966ed4c460b90dba70855f4dc50685dff97f Reviewed-on: http://codereview.qt.nokia.com/1712 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/corelib/tools/qrefcount.h')
-rw-r--r--src/corelib/tools/qrefcount.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/tools/qrefcount.h b/src/corelib/tools/qrefcount.h
index 9223cfe352..e72ddf66b6 100644
--- a/src/corelib/tools/qrefcount.h
+++ b/src/corelib/tools/qrefcount.h
@@ -57,12 +57,12 @@ class RefCount
{
public:
inline void ref() {
- if (atomic >= 0)
+ if (atomic > 0)
atomic.ref();
}
inline bool deref() {
- if (atomic < 0)
+ if (atomic <= 0)
return true;
return atomic.deref();
}