Use wx_ptr for the splash screen.
[dcpomatic.git] / src / wx / wx_ptr.h
index 96459183ee070832a3e887e53d9def687f490399..24bccb0438a517b59a9c9a8b4d70c9149a87380c 100644 (file)
@@ -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)
        {