Kaydet (Commit) 88b6dd3e authored tarafından Miklos Vajna's avatar Miklos Vajna

lokdocview: GTK+ calls should be made from the main thread

Change-Id: Ia76ef111170700ef507550222ca917986d4fe00e
üst a0fa0fb5
...@@ -368,6 +368,16 @@ hyperlinkClicked(LOKDocView* pDocView, const std::string& rString) ...@@ -368,6 +368,16 @@ hyperlinkClicked(LOKDocView* pDocView, const std::string& rString)
g_signal_emit(pDocView, doc_view_signals[HYPERLINK_CLICKED], 0, rString.c_str()); 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(); /// Implementation of the global callback handler, invoked by globalCallback();
static gboolean static gboolean
globalCallback (gpointer pData) globalCallback (gpointer pData)
...@@ -1249,7 +1259,7 @@ setEditInThread(gpointer data) ...@@ -1249,7 +1259,7 @@ setEditInThread(gpointer data)
} }
priv->m_bEdit = bEdit; priv->m_bEdit = bEdit;
g_signal_emit(pDocView, doc_view_signals[EDIT_CHANGED], 0, bWasEdit); 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 static void
...@@ -1305,7 +1315,7 @@ paintTileInThread (gpointer data) ...@@ -1305,7 +1315,7 @@ paintTileInThread (gpointer data)
//create a mapping for it //create a mapping for it
buffer.m_mTiles[index].setPixbuf(pPixBuf); buffer.m_mTiles[index].setPixbuf(pPixBuf);
buffer.m_mTiles[index].valid = true; buffer.m_mTiles[index].valid = true;
gtk_widget_queue_draw(GTK_WIDGET(pDocView)); gdk_threads_add_idle(queueDraw, GTK_WIDGET(pDocView));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment