summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fxcrt/maybe_owned.h2
-rw-r--r--core/fxcrt/observable.h6
-rw-r--r--core/fxcrt/weak_ptr.h6
3 files changed, 7 insertions, 7 deletions
diff --git a/core/fxcrt/maybe_owned.h b/core/fxcrt/maybe_owned.h
index 511e63223b..26e9d6fe1c 100644
--- a/core/fxcrt/maybe_owned.h
+++ b/core/fxcrt/maybe_owned.h
@@ -21,7 +21,7 @@ namespace fxcrt {
template <typename T, typename D = std::default_delete<T>>
class MaybeOwned {
public:
- MaybeOwned() : m_pObj(nullptr) {}
+ MaybeOwned() = default;
explicit MaybeOwned(T* ptr) : m_pObj(ptr) {}
explicit MaybeOwned(const UnownedPtr<T>& ptr) : m_pObj(ptr.Get()) {}
explicit MaybeOwned(std::unique_ptr<T, D> ptr)
diff --git a/core/fxcrt/observable.h b/core/fxcrt/observable.h
index e99dadfc8e..e118dc898b 100644
--- a/core/fxcrt/observable.h
+++ b/core/fxcrt/observable.h
@@ -25,13 +25,13 @@ class Observable {
// Simple case of a self-nulling pointer.
class ObservedPtr final : public Observer {
public:
- ObservedPtr() : m_pObservable(nullptr) {}
+ ObservedPtr() = default;
explicit ObservedPtr(T* pObservable) : m_pObservable(pObservable) {
if (m_pObservable)
m_pObservable->AddObserver(this);
}
ObservedPtr(const ObservedPtr& that) : ObservedPtr(that.Get()) {}
- ~ObservedPtr() {
+ ~ObservedPtr() override {
if (m_pObservable)
m_pObservable->RemoveObserver(this);
}
@@ -60,7 +60,7 @@ class Observable {
T* operator->() const { return m_pObservable; }
private:
- T* m_pObservable;
+ T* m_pObservable = nullptr;
};
Observable() = default;
diff --git a/core/fxcrt/weak_ptr.h b/core/fxcrt/weak_ptr.h
index 3ec3942c5f..7b345aa993 100644
--- a/core/fxcrt/weak_ptr.h
+++ b/core/fxcrt/weak_ptr.h
@@ -58,8 +58,8 @@ class WeakPtr {
private:
class Handle {
public:
- explicit Handle(std::unique_ptr<T, D> ptr)
- : m_nCount(0), m_pObj(std::move(ptr)) {}
+ explicit Handle(std::unique_ptr<T, D> ptr) : m_pObj(std::move(ptr)) {}
+
void Reset(std::unique_ptr<T, D> ptr) { m_pObj = std::move(ptr); }
void Clear() { // Now you're all weak ptrs ...
m_pObj.reset(); // unique_ptr nulls first before invoking delete.
@@ -78,7 +78,7 @@ class WeakPtr {
private:
~Handle() = default;
- intptr_t m_nCount;
+ intptr_t m_nCount = 0;
std::unique_ptr<T, D> m_pObj;
};