Blob Blame History Raw
From caed71af04cce001917ad68ee556a687af35baf8 Mon Sep 17 00:00:00 2001
From: John Cupitt <jcupitt@gmail.com>
Date: Fri, 16 Dec 2022 11:32:16 +0000
Subject: [PATCH] emit "finish" at the end of targetcustom write

In 8.13 we deprecated target_finish() (it did not have an error return)
to target_end() (now has an error return).

This PR makes target_end() also emit the "finish" signal for
compatibility with the previous API. ruby-vips, for example, looks for
on_finish() to close files.

See https://github.com/libvips/ruby-vips/issues/351

Thanks lucaskanashiro
---
 ChangeLog                      | 1 +
 libvips/iofuncs/targetcustom.c | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/libvips/iofuncs/targetcustom.c b/libvips/iofuncs/targetcustom.c
index 603422d5c4..82237458ac 100644
--- a/libvips/iofuncs/targetcustom.c
+++ b/libvips/iofuncs/targetcustom.c
@@ -161,6 +161,11 @@ vips_target_custom_end_real( VipsTarget *target )
 
 	VIPS_DEBUG_MSG( "vips_target_custom_end_real:\n" );
 
+	/* For compatibility with oklder libvipses, we have to emit "finish"
+	 * as well. ruby-vips relies on this.
+	 */
+	g_signal_emit( target, vips_target_custom_signals[SIG_FINISH], 0 );
+
 	/* Return value if no attached handler.
 	 */
 	result = 0;