Conversation
|
+1, I've encountered similar issues that were resolved by locking the ctx.tgt.Lock()
ctx.tgt.Clear()
ctx.tgt.Unlock() |
|
ooooh, the TextView itself is lockable, I didn't realze that's something I could do. That will almost certainly fix it, thanks. |
|
I wanted to quickly follow up and request a different strategy: instead of merging this, let's remove the locking from around writes and leave it to the user. Otherwise if I want to clear a buffer and then do a bunch of writes I incur lock overhead each time. Instead I would prefer to lock at the beginning of my function, clear, do writes in a tight loop, etc. then unlock. |
|
if you take that approach, please document it clearly in the concurrency section of the wiki! Also this will be extremely non-back-compatible |
|
This will not be needed anymore. |
Fix #636
I think the problem is TextView.Clear is not locking.
When we clear the TextView, the buffer will be nil.
So call Clear while drawing buffer, it will panic with that stack trace.