fix refleak in webpsave_buffer

And add teardown to the test-suite so we can spot refleaks more easily.
This commit is contained in:
John Cupitt 2019-12-21 05:13:54 +00:00
parent 4b0c2924ab
commit 1e2ca2e0bf
6 changed files with 35 additions and 0 deletions

View File

@ -397,6 +397,8 @@ vips_foreign_save_webp_buffer_build( VipsObject *object )
g_object_set( buffer, "buffer", blob, NULL );
vips_area_unref( VIPS_AREA( blob ) );
VIPS_UNREF( streamo );
return( 0 );
}

View File

@ -41,6 +41,12 @@ class TestArithmetic:
cls.mono = cls.colour.extract_band(1)
cls.all_images = [cls.mono, cls.colour]
@classmethod
def teardown_class(cls):
cls.colour = None
cls.mono = None
cls.all_images = None
# test all operator overloads we define
def test_add(self):

View File

@ -44,6 +44,13 @@ class TestConversion:
cls.all_images = [cls.mono, cls.colour]
cls.image = pyvips.Image.jpegload(JPEG_FILE)
@classmethod
def teardown_class(cls):
cls.colour = None
cls.mono = None
cls.image = None
cls.all_images = None
def test_band_and(self):
def band_and(x):
if isinstance(x, pyvips.Image):

View File

@ -55,6 +55,17 @@ class TestConvolution:
[-1, -2, -1]])
cls.all_masks = [cls.sharp, cls.blur, cls.line, cls.sobel]
@classmethod
def teardown_class(cls):
cls.colour = None
cls.mono = None
cls.all_images = None
cls.sharp = None
cls.blur = None
cls.line = None
cls.sobel = None
cls.all_masks = None
def test_conv(self):
for im in self.all_images:
for msk in self.all_masks:

View File

@ -38,6 +38,11 @@ class TestForeign:
@classmethod
def teardown_class(cls):
shutil.rmtree(cls.tempdir, ignore_errors=True)
cls.colour = None
cls.mono = None
cls.rad = None
cls.cmyk = None
cls.onebit = None
# we have test files for formats which have a clear standard
def file_loader(self, loader, test_file, validate):

View File

@ -37,6 +37,10 @@ class TestStream:
@classmethod
def teardown_class(cls):
shutil.rmtree(cls.tempdir, ignore_errors=True)
cls.colour = None
cls.mono = None
cls.rad = None
cls.cmyk = None
def test_streami_new_from_file(self):
x = pyvips.Streami.new_from_file(JPEG_FILE)