summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qcore_mac_p.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index dc3f172937f..be839debd57 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -407,7 +407,6 @@ public:
QMacKeyValueObserver() = default;
#if defined( __OBJC__)
- // Note: QMacKeyValueObserver must not outlive the object observed!
QMacKeyValueObserver(NSObject *object, NSString *keyPath, Callback callback,
NSKeyValueObservingOptions options = NSKeyValueObservingOptionNew)
: object(object), keyPath(keyPath), callback(new Callback(callback))
@@ -435,7 +434,7 @@ public:
void swap(QMacKeyValueObserver &other) noexcept
{
- qt_ptr_swap(object, other.object);
+ std::swap(object, other.object);
qt_ptr_swap(keyPath, other.keyPath);
callback.swap(other.callback);
}
@@ -445,7 +444,7 @@ private:
void addObserver(NSKeyValueObservingOptions options);
#endif
- NSObject *object = nullptr;
+ QObjCWeakPointer<NSObject> object;
NSString *keyPath = nullptr;
std::unique_ptr<Callback> callback;