diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-01-15 01:25:27 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-01-15 01:25:27 +0100 |
| commit | 963c7649da903b87637975e8c2d634da887d3109 (patch) | |
| tree | ab59391e9f4fd5a35f4bec052b97d4e703b007cd /src/wx/wx_ptr.h | |
| parent | fcaf62b405f6379e7030ddc2a38426c5f9ffb081 (diff) | |
Use wx_ptr for the splash screen.
Diffstat (limited to 'src/wx/wx_ptr.h')
| -rw-r--r-- | src/wx/wx_ptr.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/wx/wx_ptr.h b/src/wx/wx_ptr.h index 96459183e..24bccb043 100644 --- a/src/wx/wx_ptr.h +++ b/src/wx/wx_ptr.h @@ -62,11 +62,34 @@ public: } } - T* operator->() { + wx_ptr& operator=(T* ptr) + { + if (_wx) { + _wx->Destroy(); + } + _wx = ptr; + return *this; + } + + T* operator->() + { DCPOMATIC_ASSERT(_wx); return _wx; } + operator bool() const + { + return _wx != nullptr; + } + + void reset() + { + if (_wx) { + _wx->Destroy(); + _wx = nullptr; + } + } + template <typename... Args> void reset(Args&&... args) { |
