Index: gnucash-sheet.c
===================================================================
--- gnucash-sheet.c	(revision 18639)
+++ gnucash-sheet.c	(working copy)
@@ -202,6 +202,9 @@
 static void
 gnucash_sheet_stop_editing (GnucashSheet *sheet)
 {
+	/* Rollback an uncommitted string if it exists   *
+	 * *before* disconnecting signal handlers.       */
+	gnucash_sheet_im_context_reset(sheet);
 
         if (sheet->insert_signal != 0)
                 g_signal_handler_disconnect (G_OBJECT(sheet->entry),
@@ -221,7 +224,6 @@
 	if (sheet->delete_surrounding_signal != 0)
                 g_signal_handler_disconnect (G_OBJECT(sheet->im_context),
                                              sheet->delete_surrounding_signal);
-
         sheet->insert_signal = 0;
         sheet->delete_signal = 0;
 	sheet->commit_signal = 0;
@@ -229,14 +231,10 @@
 	sheet->retrieve_surrounding_signal = 0;
 	sheet->delete_surrounding_signal = 0;
 
-	gnucash_sheet_im_context_reset(sheet);
-
         gnucash_sheet_hide_editing_cursor (sheet);
 
         sheet->editing = FALSE;
         sheet->input_cancelled = FALSE;
-
-
 }
 
 
