summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-01-16 01:13:25 +0100
committerCarl Hetherington <cth@carlh.net>2023-01-16 01:13:25 +0100
commit59ad7b04f7f49a06e1476472d5a3fddc1d241685 (patch)
tree42d213681a78c4132b23ea09a090b7d574fd918c
parentd361b99f8dc8b9b1bcde40e0056e3fc796e5583c (diff)
Make reset() safer if the new throws.
-rw-r--r--src/wx/wx_ptr.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/wx/wx_ptr.h b/src/wx/wx_ptr.h
index 24bccb043..fcca8b18b 100644
--- a/src/wx/wx_ptr.h
+++ b/src/wx/wx_ptr.h
@@ -95,6 +95,7 @@ public:
{
if (_wx) {
_wx->Destroy();
+ _wx = nullptr;
}
_wx = new T(std::forward<Args>(args)...);
}