[webkit-dev] Protecting against stale pointers in DrawingBuffer and GraphicsContext3D

Chris Marrin cmarrin at apple.com
Tue Oct 12 12:00:36 PDT 2010


On Oct 12, 2010, at 10:44 AM, Darin Adler wrote:

> On Oct 12, 2010, at 9:47 AM, Chris Marrin wrote:
> 
>> But refcounting is simpler and my current patch has a clear() method on DrawingBuffer which gets rid of all the resources. I could leave that method and change to a refcounted model, so the author can control when the resources are destroyed. 
>> 
>> What do you think, James?
> 
> I think that the combination of reference counting and explicit cleanup is a good one, relatively easy to program correctly with, and I would lean toward that combination.
> 
> The main cost of successfully implementing that design is making sure that each function on DrawingBuffer is either harmless to call after clear() or contains an assertion that it is not called after clear() with some solid reason to know it won’t be called.

Ok, I'll redo the patch using that technique. And yes, clear() sets the GraphicsContext3D pointer to 0 and I check that pointer for null in each call.

-----
~Chris
cmarrin at apple.com






More information about the webkit-dev mailing list