Added buffer flush and wait for window rearrange in shutdown_glk()
authorPhilip Chimento <philip.chimento@gmail.com>
Sun, 29 Nov 2009 20:09:56 +0000 (20:09 +0000)
committerPhilip Chimento <philip.chimento@gmail.com>
Sun, 29 Nov 2009 20:09:56 +0000 (20:09 +0000)
git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@191 ddfedd41-794f-dd11-ae45-00112f111e67

libchimara/abort.c

index 5a812cfc200ac4ba9d7b75a9688a414f94146a4d..517dec5649761308b2592be09f6c78feced3c94c 100644 (file)
@@ -72,7 +72,7 @@ shutdown_glk(void)
        /* Stop any timers */
        glk_request_timer_events(0);
 
-       /* Cancel any pending input requests */
+       /* Cancel any pending input requests and flush all window buffers */
        winid_t win;
        for(win = glk_window_iterate(NULL, NULL); win; win = glk_window_iterate(win, NULL))
        {
@@ -90,6 +90,8 @@ shutdown_glk(void)
                        default:
                                ; /* Handle mouse and hyperlink requests */
                }
+
+               flush_window_buffer(win);
        }
 
        /* Close any open resource files */
@@ -102,6 +104,11 @@ shutdown_glk(void)
        g_async_queue_unref(glk_data->char_input_queue);
        g_async_queue_unref(glk_data->line_input_queue);
 
-       printf("cleaning up...\n");
+       /* Wait for any pending window rearrange */
+       g_mutex_lock(glk_data->arrange_lock);
+       if(glk_data->needs_rearrange)
+               g_cond_wait(glk_data->rearranged, glk_data->arrange_lock);
+       g_mutex_unlock(glk_data->arrange_lock);
+
        chimara_glk_reset(glk_data->self);
 }