Skip to content

Commit a32c3b4

Browse files
committed
Prevent reference to deleted 'impl' in self-assignment.
1 parent bd4fa6c commit a32c3b4

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/emc/rs274ngc/interp_python.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ pycontext::~pycontext() { delete impl; }
293293
pycontext::pycontext(const pycontext &other)
294294
: impl(new pycontext_impl(*other.impl)) {}
295295
pycontext &pycontext::operator=(const pycontext &other) {
296+
if(&other == this) // Assign to self
297+
return *this;
296298
delete impl;
297299
impl = new pycontext_impl(*other.impl);
298300
return *this;

0 commit comments

Comments
 (0)