summaryrefslogtreecommitdiff
path: root/include/vcl/vclptr.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-05-31 09:51:54 +0200
committerStephan Bergmann <sbergman@redhat.com>2017-05-31 09:51:54 +0200
commit052f25429eb6bf832c9e9bca6169755966ea794d (patch)
tree042ee8fc7f67cb84dd1eeaac3b73d581680f2ddf /include/vcl/vclptr.hxx
parentbef247d1370d9a5a83bfd2ccde70db37da0e7f30 (diff)
Guard against ScopedVclPtr "self assignment" (just in case)
Change-Id: I12bbfbc6701e4e666d30dcf89c17be8f1a5d6858
Diffstat (limited to 'include/vcl/vclptr.hxx')
-rw-r--r--include/vcl/vclptr.hxx6
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);
+ }
}
/**