Thread UserInterfaceUpdate not running when thread quits shortly after?

A possible bug I found when playing with the demo project attached to Can someone confirm?

– Add a few shorter iterations to to PopupMenu1.Open, like

Me.RowTagAt(Me.LastAddedRowIndex) = 10000
Me.RowTagAt(Me.LastAddedRowIndex) = 100000
Me.AddRow("One Million")
Me.RowTagAt(Me.LastAddedRowIndex) = 1000000

Then run the project with one of these low counts – works for me the same in debugger as in a build.
You will find that the traditional text is updated but the result of the ternary test stays hidden and the progress wheel keeps on spinning. I have the feeling that the thread completes before firing its ternary UIUpdate when the total run time has been relatively short. A breakpoint in the ternary test method reveals the respective line was run.
Found so on Xojo2021r3, macOS Big Sur and Windows 10.

I always do:

me.sleep (1000)

just before the final Return in a thread. This allows any pending UI changes to complete.

Thanks, Tim. Try it please as described and add a me.sleep(1000) to the end of thread1.Run. Does not change anything for me. Also yieldToNext.

Wrong alert. I had not inspected the code closely enough. It was only inspecting data(0) in UserInterfaceUpdate, but in a short run both update dictionaries are sent in one event.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.