window: delay setting ref count (#2690)

fixes an assert fail in window_free
This commit is contained in:
Lovell Fuller 2022-02-27 09:50:04 +00:00 committed by GitHub
parent 802dabc6aa
commit 6639b90f22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -277,7 +277,7 @@ vips_window_new( VipsImage *im, int top, int height )
if( !(window = VIPS_NEW( NULL, VipsWindow )) )
return( NULL );
window->ref_count = 1;
window->ref_count = 0;
window->im = im;
window->top = 0;
window->height = 0;
@ -290,6 +290,7 @@ vips_window_new( VipsImage *im, int top, int height )
vips_window_free( window );
return( NULL );
}
window->ref_count = 1;
#ifdef DEBUG
printf( "** vips_window_new: window top = %d, height = %d (%p)\n",