From 6e528dac8a7a8719345f7f0faf8be4febfcf87dc Mon Sep 17 00:00:00 2001
From: Lars Kanis <kanis@comcard.de>
Date: Tue, 7 Jul 2015 10:49:44 +0200
Subject: [PATCH] Even if setText typically doesn't break, if called from a
 second thread, it's better to use runOnUiThread in souch a case.

---
 examples/groupbox.rb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/examples/groupbox.rb b/examples/groupbox.rb
index 26a99b7..6076d99 100755
--- a/examples/groupbox.rb
+++ b/examples/groupbox.rb
@@ -361,12 +361,14 @@ class GroupWindow < FXMainWindow
     show(PLACEMENT_SCREEN)
 
     # Create a thread to update the clock
-    @clockThread = Thread.new(@clockLabel) { |clockLabel|
+    @clockThread = Thread.new(@clockLabel) do |clockLabel|
       while true
-        clockLabel.text = Time.now.strftime("%I:%M:%S %p")
+        runOnUiThread do
+          clockLabel.text = Time.now.strftime("%I:%M:%S %p")
+        end
         sleep(1)
       end
-    }
+    end
   end
 end
 
-- 
GitLab