Ref buffer while it's being painted, unref when done