The following patches fixe the crash when for example the user uses a
bind file instead of a kmap file.

What it does is disable a keymap when there has been a read error. I
tried to resist the urge to rewrite all the code :)

Comments and even testing welcome. I'll apply soon if there are no
complaints.


JMarc

Index: src/intl.C
===================================================================
--- src/intl.C	(revision 13965)
+++ src/intl.C	(working copy)
@@ -77,6 +77,12 @@ void Intl::initKeyMapper(bool on)
 {
 	lyxerr[Debug::INIT] << "Initializing key mappings..." << endl;
 
+	if (trans.SetPrimary(prim_lang) == -1)
+		prim_lang.erase();
+	if (trans.SetSecondary(sec_lang) == -1)
+		sec_lang.erase();
+	trans.setCharset(lyxrc.font_norm);
+
 	if (prim_lang.empty() && sec_lang.empty())
 		keymapon = false;
 	else
@@ -86,8 +92,4 @@ void Intl::initKeyMapper(bool on)
 
 	if (keymapon)
 		keyMapPrim();
-
-	trans.setPrimary(prim_lang);
-	trans.setSecondary(sec_lang);
-	trans.setCharset(lyxrc.font_norm);
 }
Index: src/intl.C
===================================================================
--- src/intl.C	(revision 13949)
+++ src/intl.C	(working copy)
@@ -77,6 +77,12 @@ void Intl::InitKeyMapper(bool on)
 {
 	lyxerr[Debug::INIT] << "Initializing key mappings..." << endl;
 
+	if (trans.SetPrimary(prim_lang) == -1)
+		prim_lang.erase();
+	if (trans.SetSecondary(sec_lang) == -1)
+		sec_lang.erase();
+	trans.setCharset(lyxrc.font_norm);
+
 	if (prim_lang.empty() && sec_lang.empty())
 		keymapon = false;
 	else
@@ -86,8 +92,4 @@ void Intl::InitKeyMapper(bool on)
 
 	if (keymapon)
 		KeyMapPrim();
-
-	trans.SetPrimary(prim_lang);
-	trans.SetSecondary(sec_lang);
-	trans.setCharset(lyxrc.font_norm);
 }
Index: src/ChangeLog
===================================================================
--- src/ChangeLog	(revision 13949)
+++ src/ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2006-05-30  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* intl.C (InitKeyMapper): reset kbmap file names if the files
+	could not be read (bug 2604).
+
 2006-05-22  Jürgen Spitzmüller  <[EMAIL PROTECTED]>
 
 	* BufferView_pimpl.C (getStatus): Disable saving of bookmarks in
Index: status.14x
===================================================================
--- status.14x	(revision 13960)
+++ status.14x	(working copy)
@@ -111,7 +111,10 @@ What's new
 - Fix display of horizontal fill which appears at the end of a line
   (bug 2508).
 
-- Fix crash when changing document class while the cursor is inside a table
+- Fix crash when changing document class while the cursor is inside a
+  table.
+
+- Fix crash when there is a syntax error in a keyboard map file (bug 2604).
 
 * Configuration/Installation:
 

Reply via email to