X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Frefptr.h;fp=source%2Fcore%2Frefptr.h;h=79401dce5be40094a9f55212c0c3fb4abd8f7dc9;hp=34560ec0389beea43bbfb66fe2db1bd111bb954a;hb=d15b96b498d7cad51a0cb1dd949f70a04af246e9;hpb=41363aed34382386f915f17c1a961750b4fdcb14 diff --git a/source/core/refptr.h b/source/core/refptr.h index 34560ec..79401dc 100644 --- a/source/core/refptr.h +++ b/source/core/refptr.h @@ -151,6 +151,9 @@ template template RefPtr &RefPtr::assign(const RefPtr &p) { + if(static_cast(&p)==this) + return *this; + decref(); data = p.data; counts = p.counts; @@ -195,6 +198,9 @@ template template WeakPtr &WeakPtr::assign(const WeakPtr &p) { + if(&p==this) + return *this; + decref(); data = p.get(); counts = (data ? p.counts : nullptr);