diff options
-rw-r--r-- | include/vcl/vclptr.hxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx index a11552635082..8dc250c7a640 100644 --- a/include/vcl/vclptr.hxx +++ b/include/vcl/vclptr.hxx @@ -316,8 +316,10 @@ public: */ void disposeAndReset(reference_type *pBody) { - VclPtr<reference_type>::disposeAndClear(); - VclPtr<reference_type>::set(pBody); + if (pBody != this->get()) { + VclPtr<reference_type>::disposeAndClear(); + VclPtr<reference_type>::set(pBody); + } } /** |