- // This needs to be static to avoid a memory leak. When a Buffer is
- // constructed, it constructs a BufferParams, which in turn constructs
- // a DocumentClass, via new, that is never deleted. If we were to go to
- // some kind of garbage collection there, or a shared_ptr, then this
- // would not be needed.
- static Buffer * buffer = theBufferList().newBuffer(
- FileName::tempName().absFileName() + "_clipboard.internal");
+ // This used to need to be static to avoid a memory leak. It no longer needs
+ // to be so, but the alternative is to construct a new one of these (with a
+ // new temporary directory, etc) every time, and then to destroy it. So maybe
+ // it's worth just keeping this one around.
+ static Buffer * buffer = theBufferList().newInternalBuffer(
+ FileName::tempName("clipboard.internal").absFileName());