summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2016-04-13 14:09:35 +0200
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2016-04-13 13:18:48 +0000
commit17ad6e2a93f93aaa948c1286b3cad785e7f38808 (patch)
tree2acce8af8ad913b2b268543a6ff8799a2afdf861 /src/corelib/kernel
parent96ff51f856c34c7826c13c2d4c376022e6b7d027 (diff)
Fix build when Qt is used in an automatic reference-counted environment
When automatic reference-counting (ARC) is enabled on Darwin platforms the NSAutoReleasePool class should not be used directly, which caused a build error if qglobal.h was included after the Foundation.h in client code. The preferred alternative for ARC is the scoped @autoreleasepool construct, which allows the compiler to reason about needing to insert _objc_autoreleasePoolPush and _objc_autoreleasePoolPop calls. Note that ARC translation units can be combined with non-ARC translation units, so Qt and the QMacAutoReleasePool class can still be used in ARC client code even if Qt is not built with ARC. Task-number: QTBUG-51332 Change-Id: I7ef1c3146aa416a9d6a1dc299ce7b17f22f889e5 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcore_mac_objc.mm2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm
index 1a2b047041..e1480a36d5 100644
--- a/src/corelib/kernel/qcore_mac_objc.mm
+++ b/src/corelib/kernel/qcore_mac_objc.mm
@@ -150,7 +150,7 @@ QMacAutoReleasePool::~QMacAutoReleasePool()
// Drain behaves the same as release, with the advantage that
// if we're ever used in a garbage-collected environment, the
// drain acts as a hint to the garbage collector to collect.
- [pool drain];
+ [static_cast<NSAutoreleasePool*>(pool) drain];
}
// -------------------------------------------------------------------------