I have NSTextView that i add text to using
def puts(val)
storage = @output.textStorage
storage.beginEditing
storage.appendAttributedString(NSAttributedString.alloc.initWithString(val+"\n"))
storage.endEditing
end
This works for few times but at some point in time it hangs the whole program (spinning ball of death).
I'm calling this method from MacRuby thread so i think that it has something to do with it.
I set the string
property of my NSTextView
called home_text
by
home_text.string = "a very loooooong string"
I've Never had a "beach volleyball/pizza of death". When I'm not sure I can rely on a default value I add a control on the string I want to add to the NSTextView
to avoid setting it to a nil value. Basic stuff here, I know sorry!
Are you doing any I/O operation, in your main thread or somewhere else, without using Cocoa most robust Asynchronous APIs? Like downloading stuff from the web which , for example, would be performed more safely using NSURLDownload
instead of either
Net::HTTP.get('...a url...','..a path..")
or
download_url = NSURl.UrlWithString '...a url...'
download_data = NSMutableStringalloc.initWithContentsOfUrl(download_url,
encoding:...,
error:...)
that are synchronous. This could explain the randomness of your problem, although it's just one of the possible causes.