From: Philip Chimento Date: Wed, 7 Oct 2009 21:14:29 +0000 (+0000) Subject: Fixed bug - put array unregister function after line input into correct thread X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=53af2af2a35b5a560d0e5c6a18b3d26e8748729b;p=rodin%2Fchimara.git Fixed bug - put array unregister function after line input into correct thread git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@135 ddfedd41-794f-dd11-ae45-00112f111e67 --- diff --git a/libchimara/event.c b/libchimara/event.c index 4bbb391..ca5e21a 100644 --- a/libchimara/event.c +++ b/libchimara/event.c @@ -1,6 +1,7 @@ #include "event.h" #include "magic.h" #include "glk.h" +#include "window.h" #include #include "chimara-glk.h" @@ -92,6 +93,15 @@ glk_select(event_t *event) /* Check for interrupt */ glk_tick(); + + /* If the event was a line input event, the library must release the buffer */ + if(event->type == evtype_LineInput && glk_data->unregister_arr) + { + if(event->win->input_request_type == INPUT_REQUEST_LINE_UNICODE) + (*glk_data->unregister_arr)(event->win->line_input_buffer_unicode, event->win->line_input_buffer_max_len, "&+#!Iu", event->win->buffer_rock); + else + (*glk_data->unregister_arr)(event->win->line_input_buffer, event->win->line_input_buffer_max_len, "&+#!Cn", event->win->buffer_rock); + } /* If an abort event was generated, the thread should have exited by now */ g_assert(event->type != evtype_Abort); diff --git a/libchimara/input.c b/libchimara/input.c index 7394ce3..44334b4 100644 --- a/libchimara/input.c +++ b/libchimara/input.c @@ -589,15 +589,6 @@ after_window_insert_text(GtkTextBuffer *textbuffer, GtkTextIter *location, gchar int chars_written = flush_text_buffer(win); event_throw(CHIMARA_GLK(gtk_widget_get_ancestor(win->widget, CHIMARA_TYPE_GLK)), evtype_LineInput, win, chars_written, 0); - - ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key); - if(glk_data->unregister_arr) - { - if(win->input_request_type == INPUT_REQUEST_LINE_UNICODE) - (*glk_data->unregister_arr)(win->line_input_buffer_unicode, win->line_input_buffer_max_len, "&+#!Iu", win->buffer_rock); - else - (*glk_data->unregister_arr)(win->line_input_buffer, win->line_input_buffer_max_len, "&+#!Cn", win->buffer_rock); - } } } @@ -610,13 +601,5 @@ on_input_entry_activate(GtkEntry *input_entry, winid_t win) int chars_written = flush_text_grid(win); event_throw(CHIMARA_GLK(gtk_widget_get_ancestor(win->widget, CHIMARA_TYPE_GLK)), evtype_LineInput, win, chars_written, 0); - ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key); - if(glk_data->unregister_arr) - { - if(win->input_request_type == INPUT_REQUEST_LINE_UNICODE) - (*glk_data->unregister_arr)(win->line_input_buffer_unicode, win->line_input_buffer_max_len, "&+#!Iu", win->buffer_rock); - else - (*glk_data->unregister_arr)(win->line_input_buffer, win->line_input_buffer_max_len, "&+#!Cn", win->buffer_rock); - } }