summaryrefslogtreecommitdiff
path: root/libreofficekit
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-09-11 11:27:08 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-09-11 11:43:22 +0200
commit88b6dd3ea77ca9f6d5fac2965cea6ff0634e6ba5 (patch)
treec9d199824f8f6596b5c0e10ecc0ce168e9ecb703 /libreofficekit
parenta0fa0fb57d61e6caa3ecd10fa94806ea9de82b94 (diff)
lokdocview: GTK+ calls should be made from the main thread
Change-Id: Ia76ef111170700ef507550222ca917986d4fe00e
Diffstat (limited to 'libreofficekit')
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 41ec8f0b2f21..4448026220a4 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));
}