diff options
| author | Minglangjun Li <liminglangjun@gmail.com> | 2017-03-19 05:03:55 +0000 |
|---|---|---|
| committer | Minglangjun Li <liminglangjun@gmail.com> | 2017-03-19 05:03:55 +0000 |
| commit | 9e2d75331ec8fa10b2fbdd7216ef2226995bea82 (patch) | |
| tree | 639c33436fb36fc2cbec778d374388d20a22a12d | |
| parent | msys2installdeps.sh - Fix broken for loops (thanks for noticing jazzynico!) a... (diff) | |
| download | inkscape-9e2d75331ec8fa10b2fbdd7216ef2226995bea82.tar.gz inkscape-9e2d75331ec8fa10b2fbdd7216ef2226995bea82.zip | |
Fix lp:1670688.
Fixed bugs:
- https://launchpad.net/bugs/1670688
(bzr r15577.1.1)
| -rw-r--r-- | src/desktop.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp index 2476b10bb..a5bf99e55 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1531,12 +1531,16 @@ SPDesktop::setDocument (SPDocument *doc) layers->setDocument(doc); selection->setDocument(doc); - // remove old EventLog if it exists (see also: bug #1071082) - if (event_log) { - doc->removeUndoObserver(*event_log); - delete event_log; - event_log = 0; - } + if (event_log) { + // Remove it from the replaced document. This prevents Inkscape from + // crashing since we access it in the replaced document's destructor + // which results in an undefined behavior. (See also: bug #1670688) + if (this->doc()) { + this->doc()->removeUndoObserver(*event_log); + } + delete event_log; + event_log = 0; + } /* setup EventLog */ event_log = new Inkscape::EventLog(doc); |
