-
Notifications
You must be signed in to change notification settings - Fork 757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scide: Fix a dangling pointer when removing splits #4645
Conversation
When a GenericCodeEditor is destroyed but a Document refers to it via mLastActiveEditor, said pointer is dangling and can cause a crash. For example, creating a split, removing all splits, and then recompiling the class library can cause a crash. This commit is a quick bandage, simply setting mLastActiveEditor to a null pointer in the GenericCodeEditor's destructor. A more thorough solution would be a stack of the most recently active editors, but the point is to just prevent an IDE crash right now.
thanks! two more things to make this robust:
|
awesome, thanks for the info -- didn't know about Rule of 5
i can't find a reassignment of edit: making |
https://en.cppreference.com/w/cpp/language/rule_of_three
aha, can you delete the misleading declaration of unimplemented
nice! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haven't tested it yet but code looks good! thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested this with all reproducers. After the code change above I am ready to approve this.
5e59a0d
to
c8dbec7
Compare
sweet, thanks |
Purpose and Motivation
Fixes #4133, supersedes #4363. When a GenericCodeEditor is destroyed but a Document refers to it via
mLastActiveEditor, said pointer is dangling and can cause a crash. For
example, creating a split, removing all splits, and then recompiling the
class library can cause a crash.
This commit is a quick bandage, simply setting mLastActiveEditor to a
null pointer in the GenericCodeEditor's destructor. A more thorough
solution would be a stack of the most recently active editors, but the
point is to just prevent an IDE crash right now.
Types of changes
To-do list