[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[RubyCocoa] thread and writting to UI

pere.noel

6/27/2006 12:21:00 PM



i've an app which uses threads.

if, within a thread, i write to a TextField by :


writeErrorMessage("Attente utilisateur")

with writeErrorMessage being :

def writeErrorMessage(msg)
@errorTextField.setStringValue(msg)
@errorTextField.oc_display
end

it's ok no prob.

however when writting :

writeErrorMessage(@prefs.servers.errorMessage)

i get error in GDB (unreadable for me) and the appli (from "Force to
quit" doesn't respond any more)

here is how the threads are organized :

Thread.new {
...
Thread.new {@prefs.servers.readNewsServers} #
update @prefs.servers.errorMessage depending on server answer
...
writeErrorMessage(@prefs.servers.errorMessage) => app hanging
...
}

and, if i replace "writeErrorMessage(@prefs.servers.errorMessage)" by a
console print-out :

p @prefs.servers.errorMessage

no error arrose ???


i've tried using mutex and doing "mutex.synchronize" around any change
and/or use of "@prefs.servers.errorMessage" but without a better working
way.


some ligth upon that ?

--
une bévue