Neil Hodgson wrote:
   NotifyPainted is called after all painting has been performed, so
any outstanding ownership of layout cache entries could be released
before calling NotifyPainted rather than waiting for automatic
cleanup. This is most likely the first AutoLineLayout above the
NotifyPainted call.

This would fix the NotifyPaint callback. I don't know if there are other callbacks into non-scintilla code, though. This bug took a bit of time to track down, so I'd like to put some type of check into at least the debug build to catch re-entry problems.

The quick fix is not to scroll from the handler, but I'd like to prevent
this bug from happening again.  The options are to detect re-entry into
the Paint method or to modify the layout cache so it handles re-entry.

   Making the cache reentrant is rather messy. The simplest technique
would be to hand out copies of entries rather than references into the
cache but copying a cache entry is reasonably heavy: if you do this,
I'd like to see a benchmark.

I was thinking of ref counting the layout objects and if the cache decides to free up an entry with a non-0 ref count, it would set the inCache attribute to false rather than deleting it. The layout would then be deleted when its ref count goes to 0.

John
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to