From 33c3c9ad43c88c570d3dbc8536750cfa1bca4fd4 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Fri, 11 Jun 2010 10:13:48 +0000 Subject: Ensure thread safety with idle callbacks in case application is multithreaded. See http://library.gnome.org/devel/gdk/unstable/gdk-Threads.html#id2755107 --- gtk/ScintillaGTK.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index a94cfcb13..dfe0c2f8b 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -2317,6 +2317,7 @@ int ScintillaGTK::TimeOut(ScintillaGTK *sciThis) { gboolean ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) { // Idler will be automatically stopped, if there is nothing // to do while idle. + gdk_threads_enter(); bool ret = sciThis->Idle(); if (ret == false) { // FIXME: This will remove the idler from GTK, we don't want to @@ -2324,11 +2325,14 @@ gboolean ScintillaGTK::IdleCallback(ScintillaGTK *sciThis) { // returns false (although, it should be harmless). sciThis->SetIdle(false); } + gdk_threads_leave(); return ret; } gboolean ScintillaGTK::StyleIdle(ScintillaGTK *sciThis) { + gdk_threads_enter(); sciThis->IdleStyling(); + gdk_threads_leave(); // Idler will be automatically stopped return FALSE; } -- cgit v1.2.3