From: Vadim Zeitlin Date: Fri, 14 Nov 2008 23:18:39 +0000 (+0000) Subject: assigning line marker to itself shouldn't invalidate it, add self-assignment check X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e81ea1070d473b2a0d67cf395125d0eef9eed516?ds=inline assigning line marker to itself shouldn't invalidate it, add self-assignment check git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56770 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/stc/scintilla/src/LineMarker.h b/src/stc/scintilla/src/LineMarker.h index 3cb4139f08..24e22d905f 100644 --- a/src/stc/scintilla/src/LineMarker.h +++ b/src/stc/scintilla/src/LineMarker.h @@ -39,14 +39,16 @@ public: ~LineMarker() { delete pxpm; } - LineMarker &operator=(const LineMarker &) { + LineMarker &operator=(const LineMarker &other) { // Defined to avoid pxpm being blindly copied, not as real assignment operator - markType = SC_MARK_CIRCLE; - fore = ColourDesired(0,0,0); - back = ColourDesired(0xff,0xff,0xff); - alpha = SC_ALPHA_NOALPHA; - delete pxpm; - pxpm = NULL; + if ( &other != this ) { + markType = SC_MARK_CIRCLE; + fore = ColourDesired(0,0,0); + back = ColourDesired(0xff,0xff,0xff); + alpha = SC_ALPHA_NOALPHA; + delete pxpm; + pxpm = NULL; + } return *this; } void RefreshColourPalette(Palette &pal, bool want);