fix: explicitly close PdfBitmap after copy in both PDF backends
pypdfium2's to_pil() shares native buffer memory for RGBA/RGBX/L formats via frombuffer(). The chained render().to_pil().resize() pattern allowed the PdfBitmap to reach refcount 0 mid-expression, causing GC to invoke FPDFBitmap_Destroy and free the native buffer while PIL still held a dangling pointer to it — resulting in non-deterministic SIGSEGV crashes in concurrent scenarios. Fix: store the bitmap explicitly, copy the PIL image to detach it from the shared native buffer, then close the bitmap under the lock before proceeding with the resize on the independent copy. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
C
Christoph Auer committed
b3f4e6692d81c324d301e4f6b79681e763ea9217
Parent: 8ae0974