QMacAutoReleasePool: hold root-level object in optional<>, not QScopedPointer
The payload object is fully defined in the header file, so there's no benefit in avoiding in-size use, which saves one memory allocation. Amends 4a5a4245b7f24b53847e96f1eee5445bdae537e6. Change-Id: Iece2aed22ce525da940bd493b7009baeec6d06ba Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
c889b56901
commit
e227a4bfbd
@ -541,7 +541,7 @@ QMacRootLevelAutoReleasePool::QMacRootLevelAutoReleasePool()
|
||||
if (qEnvironmentVariableIsSet(ROOT_LEVEL_POOL_DISABLE_SWITCH))
|
||||
return;
|
||||
|
||||
pool.reset(new QMacAutoReleasePool);
|
||||
pool.emplace();
|
||||
|
||||
[[[ROOT_LEVEL_POOL_MARKER alloc] init] autorelease];
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include <QtCore/qoperatingsystemversion.h>
|
||||
|
||||
#include <optional>
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
#include <mach/port.h>
|
||||
struct mach_header;
|
||||
@ -48,7 +50,6 @@ kern_return_t IOObjectRelease(io_object_t object);
|
||||
#endif
|
||||
|
||||
#include "qstring.h"
|
||||
#include "qscopedpointer.h"
|
||||
#include "qpair.h"
|
||||
|
||||
#if defined( __OBJC__) && defined(QT_NAMESPACE)
|
||||
@ -129,7 +130,7 @@ public:
|
||||
Q_NODISCARD_CTOR QMacRootLevelAutoReleasePool();
|
||||
~QMacRootLevelAutoReleasePool();
|
||||
private:
|
||||
QScopedPointer<QMacAutoReleasePool> pool;
|
||||
std::optional<QMacAutoReleasePool> pool = std::nullopt;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user