libreofficekit/source/gtk/lokdocview.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
New commits: commit b2b55e3448cb109003d80f29f5b524e0a59220ad Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Jan 9 18:12:52 2015 +0100 gtktiledviewer: invoke paintTile() on the main thread from the callback Change-Id: Id910c1905d23f16cae5b6b551c74193d46cff256 diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index 903f7e3..65fdbfd 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -149,7 +149,16 @@ void renderDocument( LOKDocView* pDocView ) gtk_image_set_from_pixbuf( GTK_IMAGE( pDocView->pCanvas ), pDocView->pPixBuf ); } -static void lok_docview_callback(int nType, const char* pPayload, void* pData) +/// Invoked on the main thread if lok_docview_callback_worker() requests so. +static gboolean lok_docview_callback(gpointer pData) +{ + LOKDocView* pDocView = pData; + renderDocument(pDocView); + return G_SOURCE_REMOVE; +} + +/// Our LOK callback, runs on the LO thread. +static void lok_docview_callback_worker(int nType, const char* pPayload, void* pData) { LOKDocView* pDocView = pData; @@ -158,7 +167,7 @@ static void lok_docview_callback(int nType, const char* pPayload, void* pData) case LOK_CALLBACK_INVALIDATE_TILES: // TODO for now just always render the document. (void)pPayload; - renderDocument( pDocView ); + gdk_threads_add_idle(lok_docview_callback, pDocView); break; default: break; @@ -185,7 +194,7 @@ SAL_DLLPUBLIC_EXPORT gboolean lok_docview_open_document( LOKDocView* pDocView, c else { renderDocument( pDocView ); - pDocView->pDocument->pClass->registerCallback(pDocView->pDocument, &lok_docview_callback, pDocView); + pDocView->pDocument->pClass->registerCallback(pDocView->pDocument, &lok_docview_callback_worker, pDocView); } return TRUE; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits