Open md2 opened 11 years ago
Could you please send me the file?
Sent. Subject is "Issue #226". How to reproduce the issue: $ mv ~/Books ~/Books.orig $ mkdir ~/Books $ rm -r ~/.FBReader Copy those two files to ~/Books $ fbreader Now
It takes several iterations for FBReader to crash.
My version of expat is 2.1.0-r2
I've fixed this annoying bug at last, I believe. Here's the patch:
diff -Naur fbreader-0.99.4.orig/fbreader/src/fbreader/FBReader.cpp fbreader-0.99.4/fbreader/src/fbreader/FBReader.cpp
--- fbreader-0.99.4.orig/fbreader/src/fbreader/FBReader.cpp 2013-02-16 10:19:04.635087381 +0700
+++ fbreader-0.99.4/fbreader/src/fbreader/FBReader.cpp 2013-02-16 10:18:52.384100608 +0700
@@ -298,7 +298,6 @@
bookTextView.setModel(0, 0);
bookTextView.setContentsModel(0);
contentsView.setModel(0);
- myModel.reset();
myModel = new BookModel(book);
ZLTextHyphenator::Instance().load(book->language());
bookTextView.setModel(myModel->bookTextModel(), book);
What happens here? myModel shared pointer resets to null pointer, and next line a new BookModel assigned to it. But in between myModel.reset() and assigning new value to myModel BookNode::highlighted() is called, which calls FBReader::currentBook(), which uses myModel, that is null now.
FBreader 0.99.2 crashes while trying to open valid fb2 file (.fb2.zip) gdb backtrace:
The issue seems to be related with contents of ~/Books directory. I've narrowed ~/Books contents to two .fb2.zip files. When these files are both present in ~/Books, I observe above crash when opening a book (with a fresh config; before I run fbreader I rm -r ~/.FBReader directory); when ~/Books contains only one of them, there are no crashes.