From: fliep 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-Tag: v0.9~330 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=3886d95d54e24e64a118956db5452a9c2653e307;p=projects%2Fchimara%2Fchimara.git Fixed bug - put array unregister function after line input into correct thread --- 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); - } }