On 06/04/2012 12:47 PM, Richard Heck wrote:
On 06/04/2012 02:14 AM, Scott Kostyshak wrote:
From: Tommaso Cucinotta [tomm...@lyx.org]
Sent: Sunday, June 03, 2012 8:17 PM

on trunk:
1) open embedded manual
2) put cursor at the very beginning of document
3) try to open Advanced Find and Replace (C-S-f)
and I get this:
lyx: SIGSEGV signal caught!
I get this from a new document. That is:

1) open a new document
2) try to open Advanced Find and Replace (C-S-f)

git bisect leads me to ead697d4b6c7

I think I may have solved that one. Now I only get the other one.

0 lyx::frontend::(anonymous namespace)::fontinfo GuiFontLoader.cpp 103 0x91836c 1 lyx::frontend::FontLoader::metrics GuiFontLoader.cpp 367 0x918450
2    lyx::theFontMetrics    GuiApplication.cpp    2678    0x8fed16
3    lyx::theFontMetrics    GuiApplication.cpp    2671    0x8fed21
4 lyx::BufferView::cursorPosAndHeight BufferView.cpp 2831 0x69b4f3 5 lyx::frontend::GuiWorkArea::Private::resizeBufferView GuiWorkArea.cpp 569 0x94c82a 6 lyx::frontend::GuiWorkArea::paintEvent GuiWorkArea.cpp 1119 0x94cf73

The problem seems to be with the font being returned: It's completely undefined.

../../src/BufferView.cpp(2830): font: family -921362 series -921362 shape -921362 size -921362 color -921362 emph -921362 underbar -921362 strikeout -921362 uuline -921362 uwave -921362 noun -921362 number -921362 lang: english

The problem turns out to be that the paragraph we are redrawing here references a non-existent Layout. This is because the copy_params() routine in FindAndReplace.cpp, although it MAKES a new DocumentClass, it never APPLIES this new DocumentClass to its Buffer. So the paragraphs in that Buffer still refer to the Layouts in the OLD DocumentClass. Which, in the new code, gets garbage collected.

I'll sort this out. I've attached a patch that seems to work, but something more elegant is probably needed.

Richard

>From c42a83742534c856b639f8190b86db036468c6e2 Mon Sep 17 00:00:00 2001
From: Richard Heck <rgh...@lyx.org>
Date: Mon, 4 Jun 2012 13:21:42 -0400
Subject: [PATCH 1/2] Temporary fix.

---
 src/BufferView.h                     |    4 ++--
 src/frontends/qt4/FindAndReplace.cpp |    2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/BufferView.h b/src/BufferView.h
index d164438..0059466 100644
--- a/src/BufferView.h
+++ b/src/BufferView.h
@@ -318,6 +318,8 @@ public:
 	void clearLastInset(Inset * inset) const;
 	/// Is the mouse hovering a clickable inset or element?
 	bool clickableInset() const;
+	///
+	void updateDocumentClass(DocumentClassConstPtr olddc);
 
 private:
 	/// noncopyable
@@ -347,8 +349,6 @@ private:
 	void updateHoveredInset() const;
 
 	///
-	void updateDocumentClass(DocumentClassConstPtr olddc);
-	///
 	int width_;
 	///
 	int height_;
diff --git a/src/frontends/qt4/FindAndReplace.cpp b/src/frontends/qt4/FindAndReplace.cpp
index a4e973b..c43064b 100644
--- a/src/frontends/qt4/FindAndReplace.cpp
+++ b/src/frontends/qt4/FindAndReplace.cpp
@@ -501,9 +501,11 @@ static void copy_params(BufferView const & bv, BufferView & dest_bv) {
 	string const & lang = doc_bp.language->lang();
 	string const & doc_class = doc_bp.documentClass().name();
 	Buffer & dest_buf = dest_bv.buffer();
+	DocumentClassConstPtr oldClass = dest_buf.params().documentClassPtr();
 	dest_buf.params().setLanguage(lang);
 	dest_buf.params().setBaseClass(doc_class);
 	dest_buf.params().makeDocumentClass();
+	dest_bv.updateDocumentClass(oldClass);
 	dest_bv.cursor().current_font.setLanguage(doc_bp.language);
 }
 
-- 
1.7.7.6

Reply via email to