diff --git a/examples/groupbox.rb b/examples/groupbox.rb
index 26a99b7aab207787d1c406614c1a938cb5d6f2fd..6076d99af195ac7d7596abb47fb83a139f86ec72 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