repo: rxvt-unicode-sixel
action: commit
revision: 
path_from: 
revision_from: ec734583a77618567e5369cf1cb0d5e4b13b0326:
path_to: 
revision_to: 
git.thebackupbox.net
rxvt-unicode-sixel
git clone git://git.thebackupbox.net/rxvt-unicode-sixel
commit ec734583a77618567e5369cf1cb0d5e4b13b0326
Author: Emanuele Giaquinta 
Date:   Mon Aug 23 16:06:44 2010 +0000

    Revert last change.

diff --git a/src/keyboard.C b/src/keyboard.C
index 630dfced57b00c34f88e687a418df5c012483341..
index ..1cca5756fdc64ec46b328ec67f5c24ce56b34998 100644
--- a/src/keyboard.C
+++ b/src/keyboard.C
@@ -173,6 +173,21 @@ keyboard_manager::clear ()
 {
   keymap.clear ();
   hash [0] = 2;
+
+  for (unsigned int i = 0; i < user_translations.size (); ++i)
+    {
+      free ((void *)user_translations [i]);
+      user_translations [i] = 0;
+    }
+
+  for (unsigned int i = 0; i < user_keymap.size (); ++i)
+    {
+      delete user_keymap [i];
+      user_keymap [i] = 0;
+    }
+
+  user_keymap.clear ();
+  user_translations.clear ();
 }

 // a wrapper for register_keymap,
@@ -214,6 +229,8 @@ keyboard_manager::register_user_translation (KeySym keysym, unsigned int state,
       else if (strncmp (translation, "builtin:", 8) == 0)
         key->type = keysym_t::BUILTIN;

+      user_keymap.push_back (key);
+      user_translations.push_back (translation);
       register_keymap (key);
     }
   else
diff --git a/src/keyboard.h b/src/keyboard.h
index 7e7ee8db2f4eb79abbed7105b953b46972b7a070..
index ..62fcbe2f43d5c3de96a30bd70349214d6d3ae40f 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -95,6 +95,9 @@ private:
   // stock keymaps are all static data
   static keysym_t stock_keymap[];
 #endif
+  // user keymaps and their .string are dynamically allocated and freed
+  vector user_keymap;
+  vector user_translations;
 };

 #endif /* KEYSYM_RESOURCE */

-----END OF PAGE-----