[Libreoffice-commits] core.git: libreofficekit/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Sep 11 02:48:36 PDT 2015


 libreofficekit/source/gtk/lokdocview.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 88b6dd3ea77ca9f6d5fac2965cea6ff0634e6ba5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Sep 11 11:27:08 2015 +0200

    lokdocview: GTK+ calls should be made from the main thread
    
    Change-Id: Ia76ef111170700ef507550222ca917986d4fe00e

diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 41ec8f0..4448026 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -368,6 +368,16 @@ hyperlinkClicked(LOKDocView* pDocView, const std::string& rString)
     g_signal_emit(pDocView, doc_view_signals[HYPERLINK_CLICKED], 0, rString.c_str());
 }
 
+/// Trigger a redraw, invoked on the main thread by other functions running in a thread.
+static gboolean queueDraw(gpointer pData)
+{
+    GtkWidget* pWidget = static_cast<GtkWidget*>(pData);
+
+    gtk_widget_queue_draw(pWidget);
+
+    return G_SOURCE_REMOVE;
+}
+
 /// Implementation of the global callback handler, invoked by globalCallback();
 static gboolean
 globalCallback (gpointer pData)
@@ -1249,7 +1259,7 @@ setEditInThread(gpointer data)
     }
     priv->m_bEdit = bEdit;
     g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit);
-    gtk_widget_queue_draw(GTK_WIDGET(pDocView));
+    gdk_threads_add_idle(queueDraw, GTK_WIDGET(pDocView));
 }
 
 static void
@@ -1305,7 +1315,7 @@ paintTileInThread (gpointer data)
     //create a mapping for it
     buffer.m_mTiles[index].setPixbuf(pPixBuf);
     buffer.m_mTiles[index].valid = true;
-    gtk_widget_queue_draw(GTK_WIDGET(pDocView));
+    gdk_threads_add_idle(queueDraw, GTK_WIDGET(pDocView));
 }
 
 


More information about the Libreoffice-commits mailing list