diff options
| author | Minglangjun Li <> | 2017-03-26 23:29:38 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2017-03-26 23:29:38 +0000 |
| commit | 9b95b20cf3db67fb5c110cc486bda8bf772b9bf0 (patch) | |
| tree | 51b3fbafd3e1e30dfb70796069331e2b0c1d61bb /src | |
| parent | Extensions: Correctly handle the xml:space="preserve" attribute for "descript... (diff) | |
| parent | Fix lp:1670688. (diff) | |
| download | inkscape-9b95b20cf3db67fb5c110cc486bda8bf772b9bf0.tar.gz inkscape-9b95b20cf3db67fb5c110cc486bda8bf772b9bf0.zip | |
Prevents crash when saving or closing a document in some cases
Fixed bugs:
- https://launchpad.net/bugs/1670688
(bzr r15608)
Diffstat (limited to 'src')
| -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 730a542e2..ccc3d3da4 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1600,12 +1600,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); |
