File: fix-symbolbrowser-remaining.patch

package info (click to toggle)
juffed 0.10-89-g3690b60-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,140 kB
  • sloc: cpp: 21,060; ansic: 446; xml: 329; sh: 68; makefile: 15
file content (21 lines) | stat: -rw-r--r-- 793 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Description: Fix SymbolBrowser getting no symbols and crashing
 If the last document is closed then a new untitled document is created.
 But this document did no get "activated" and therefore did not get any
 symbols which in turn led to a null pointer crash when trying to save
 later. The actual bug was a kept pointer to the previously closed and
 deleted document. If the new document was accidentally created at the
 same memory address then it was handled as the old and not "activated". 
Author: Philipp Wiesemann <philipp.wiesemann@arcor.de>

--- a/src/app/ui/DocViewer.cpp
+++ b/src/app/ui/DocViewer.cpp
@@ -218,6 +218,9 @@
 }
 
 void DocViewer::removeDocFromList(Juff::Document* doc) {
+	if ( curDoc_ == doc ) {
+		curDoc_ = NullDoc::instance();
+	}
 	docStack_.removeAll(doc);
 }