>>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Playing with keyboard input lead to this crash. Angus

Angus> Open LyX New document Type Control-Shift-Y Crashes in
Angus> lyxtextclass.C, line 698:

Angus> LyXLayout_ptr const & LyXTextClass::operator[](string const &
Angus> n) const { lyx::Assert(!n.empty());

This minimal patch fixes the crash. The layout-copy/layout-paste
functions seem very broken by design, though (why is this
copylayouttype thing defined in LyXText???). Also the feature would be
more useful if it copied not only the current layout, but also the
whole paragraph parameters.

Lars, can I apply? It fixes a crash (in a lfun nobody uses, probably)

JMarc

Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.996
diff -u -p -r1.996 ChangeLog
--- src/ChangeLog	16 Dec 2002 12:47:30 -0000	1.996
+++ src/ChangeLog	17 Dec 2002 15:36:07 -0000
@@ -1,3 +1,8 @@
+2002-12-17  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* text2.C (pasteEnvironmentType): avoid crash if layout-copy has
+	not been invoked
+
 2002-12-16  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* lyxrc.[Ch]:
Index: src/text2.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v
retrieving revision 1.268
diff -u -p -r1.268 text2.C
--- src/text2.C	2 Dec 2002 09:59:42 -0000	1.268
+++ src/text2.C	17 Dec 2002 15:36:08 -0000
@@ -1423,7 +1423,9 @@ void LyXText::copyEnvironmentType()
 
 void LyXText::pasteEnvironmentType(BufferView * bview)
 {
-	setLayout(bview, copylayouttype);
+	// do nothing if there has been no previous copyEnvironmentType()
+	if (!copylayouttype.empty())
+		setLayout(bview, copylayouttype);
 }
 
 

Reply via email to