libgimp: gimp_quit() is now deprecated.

This commit is contained in:
Jehan 2026-04-07 20:08:48 +02:00
parent 941bfcf918
commit 309f137ae0
7 changed files with 59 additions and 29 deletions

View file

@ -404,7 +404,7 @@ gimp_fatal_func (const gchar *log_domain,
} }
#endif /* ! G_OS_WIN32 */ #endif /* ! G_OS_WIN32 */
/* Do not end with gimp_quit(). /* Do not end with _gimp_quit().
* We want the plug-in to continue its normal crash course, otherwise * We want the plug-in to continue its normal crash course, otherwise
* we won't get the "Plug-in crashed" error in GIMP. * we won't get the "Plug-in crashed" error in GIMP.
*/ */

View file

@ -652,18 +652,20 @@ gimp_get_pdb (void)
* *
* Forcefully causes the GIMP library to exit and close down its * Forcefully causes the GIMP library to exit and close down its
* connection to main gimp application. This function never returns. * connection to main gimp application. This function never returns.
*
* It is highly unadvised to use this function since the plug-in will
* not properly return. If you need to return from a plug-in in error,
* gracefully return with [method@Procedure.new_return_values] setting
* [enum@Gimp.PDBStatusType.EXECUTION_ERROR] as a status and with a well
* written [struct@GLib.Error] message to display.
*
* Deprecated: there are no alternatives. Quit your plug-ins cleanly
* instead.
**/ **/
void void
gimp_quit (void) gimp_quit (void)
{ {
gimp_close (); _gimp_quit ();
#if defined G_OS_WIN32 && defined HAVE_EXCHNDL
if (plug_in_backtrace_path)
g_free (plug_in_backtrace_path);
#endif
exit (EXIT_SUCCESS);
} }
/** /**
@ -1036,6 +1038,29 @@ gimp_get_progname (void)
} }
/* Internal functions */
/* _gimp_quit:
*
* Forcefully causes the GIMP library to exit and close down its
* connection to main gimp application. This function never returns.
*
* To be used internally by libgimp only.
*/
void
_gimp_quit (void)
{
gimp_close ();
#if defined G_OS_WIN32 && defined HAVE_EXCHNDL
if (plug_in_backtrace_path)
g_free (plug_in_backtrace_path);
#endif
exit (EXIT_SUCCESS);
}
/* private functions */ /* private functions */
static void static void
@ -1147,7 +1172,7 @@ gimp_plugin_sigfatal_handler (gint sig_num)
break; break;
} }
/* Do not end with gimp_quit(). /* Do not end with _gimp_quit().
* We want the plug-in to continue its normal crash course, otherwise * We want the plug-in to continue its normal crash course, otherwise
* we won't get the "Plug-in crashed" error in GIMP. * we won't get the "Plug-in crashed" error in GIMP.
*/ */

View file

@ -176,9 +176,7 @@ GimpPlugIn * gimp_get_plug_in (void);
*/ */
GimpPDB * gimp_get_pdb (void); GimpPDB * gimp_get_pdb (void);
/* Forcefully causes the gimp library to exit and GIMP_DEPRECATED
* close down its connection to main gimp application.
*/
void gimp_quit (void) G_GNUC_NORETURN; void gimp_quit (void) G_GNUC_NORETURN;
/* Return various constants given by the GIMP core at plug-in config time. /* Return various constants given by the GIMP core at plug-in config time.
@ -208,6 +206,13 @@ const gchar * gimp_icon_theme_dir (void) G_GNUC_CONST;
const gchar * gimp_get_progname (void) G_GNUC_CONST; const gchar * gimp_get_progname (void) G_GNUC_CONST;
/* Forcefully causes the gimp library to exit and
* close down its connection to main gimp application.
* For internal use only.
*/
G_GNUC_INTERNAL
void _gimp_quit (void) G_GNUC_NORETURN;
G_END_DECLS G_END_DECLS
#endif /* __GIMP_H__ */ #endif /* __GIMP_H__ */

View file

@ -456,7 +456,7 @@ _gimp_pdb_run_procedure_array (GimpPDB *pdb,
if (! gp_proc_run_write (_gimp_plug_in_get_write_channel (pdb->plug_in), if (! gp_proc_run_write (_gimp_plug_in_get_write_channel (pdb->plug_in),
&proc_run, pdb->plug_in)) &proc_run, pdb->plug_in))
gimp_quit (); _gimp_quit ();
_gimp_gp_params_free (proc_run.params, proc_run.n_params, FALSE); _gimp_gp_params_free (proc_run.params, proc_run.n_params, FALSE);

View file

@ -826,7 +826,7 @@ gimp_plug_in_persistent_process (GimpPlugIn *plug_in,
else if (select_val == -1 && errno != EINTR) else if (select_val == -1 && errno != EINTR)
{ {
perror ("gimp_plug_in_persistent_process"); perror ("gimp_plug_in_persistent_process");
gimp_quit (); _gimp_quit ();
} }
} }
while (select_val == -1 && errno == EINTR); while (select_val == -1 && errno == EINTR);
@ -1006,7 +1006,7 @@ _gimp_plug_in_read_expect_msg (GimpPlugIn *plug_in,
while (TRUE) while (TRUE)
{ {
if (! gimp_wire_read_msg (priv->read_channel, msg, NULL)) if (! gimp_wire_read_msg (priv->read_channel, msg, NULL))
gimp_quit (); _gimp_quit ();
if (msg->type == type) if (msg->type == type)
return; /* up to the caller to call wire_destroy() */ return; /* up to the caller to call wire_destroy() */
@ -1358,7 +1358,7 @@ gimp_plug_in_io_error_handler (GIOChannel *channel,
gpointer data) gpointer data)
{ {
g_printerr ("%s: fatal error: GIMP crashed\n", gimp_get_progname ()); g_printerr ("%s: fatal error: GIMP crashed\n", gimp_get_progname ());
gimp_quit (); _gimp_quit ();
/* never reached */ /* never reached */
return TRUE; return TRUE;
@ -1434,7 +1434,7 @@ gimp_plug_in_single_message (GimpPlugIn *plug_in)
/* Run a temp function */ /* Run a temp function */
if (! gimp_wire_read_msg (priv->read_channel, &msg, NULL)) if (! gimp_wire_read_msg (priv->read_channel, &msg, NULL))
gimp_quit (); _gimp_quit ();
gimp_plug_in_process_message (plug_in, &msg); gimp_plug_in_process_message (plug_in, &msg);
@ -1448,7 +1448,7 @@ gimp_plug_in_process_message (GimpPlugIn *plug_in,
switch (msg->type) switch (msg->type)
{ {
case GP_QUIT: case GP_QUIT:
gimp_quit (); _gimp_quit ();
break; break;
case GP_CONFIG: case GP_CONFIG:
_gimp_config (msg->data); _gimp_config (msg->data);
@ -1500,7 +1500,7 @@ gimp_plug_in_main_proc_run (GimpPlugIn *plug_in,
if (! gp_proc_return_write (priv->write_channel, if (! gp_proc_return_write (priv->write_channel,
&proc_return, plug_in)) &proc_return, plug_in))
gimp_quit (); _gimp_quit ();
_gimp_gp_params_free (proc_return.params, proc_return.n_params, TRUE); _gimp_gp_params_free (proc_return.params, proc_return.n_params, TRUE);
} }
@ -1525,7 +1525,7 @@ gimp_plug_in_temp_proc_run (GimpPlugIn *plug_in,
if (! gp_temp_proc_return_write (priv->write_channel, if (! gp_temp_proc_return_write (priv->write_channel,
&proc_return, plug_in)) &proc_return, plug_in))
gimp_quit (); _gimp_quit ();
_gimp_gp_params_free (proc_return.params, proc_return.n_params, TRUE); _gimp_gp_params_free (proc_return.params, proc_return.n_params, TRUE);
} }

View file

@ -423,7 +423,7 @@ gimp_procedure_real_install (GimpProcedure *procedure)
if (! gp_proc_install_write (_gimp_plug_in_get_write_channel (plug_in), if (! gp_proc_install_write (_gimp_plug_in_get_write_channel (plug_in),
&proc_install, plug_in)) &proc_install, plug_in))
gimp_quit (); _gimp_quit ();
g_free (proc_install.params); g_free (proc_install.params);
g_free (proc_install.return_vals); g_free (proc_install.return_vals);
@ -491,7 +491,7 @@ gimp_procedure_real_uninstall (GimpProcedure *procedure)
if (! gp_proc_uninstall_write (_gimp_plug_in_get_write_channel (plug_in), if (! gp_proc_uninstall_write (_gimp_plug_in_get_write_channel (plug_in),
&proc_uninstall, plug_in)) &proc_uninstall, plug_in))
gimp_quit (); _gimp_quit ();
priv->installed = FALSE; priv->installed = FALSE;
} }
@ -2229,7 +2229,7 @@ gimp_procedure_persistent_ready (GimpProcedure *procedure)
if (! gp_extension_ack_write (_gimp_plug_in_get_write_channel (plug_in), if (! gp_extension_ack_write (_gimp_plug_in_get_write_channel (plug_in),
plug_in)) plug_in))
gimp_quit (); _gimp_quit ();
} }
/** /**

View file

@ -349,7 +349,7 @@ gimp_tile_get (GimpTileBackendPlugin *backend_plugin,
if (! gp_tile_req_write (_gimp_plug_in_get_write_channel (plug_in), if (! gp_tile_req_write (_gimp_plug_in_get_write_channel (plug_in),
&tile_req, plug_in)) &tile_req, plug_in))
gimp_quit (); _gimp_quit ();
_gimp_plug_in_read_expect_msg (plug_in, &msg, GP_TILE_DATA); _gimp_plug_in_read_expect_msg (plug_in, &msg, GP_TILE_DATA);
@ -378,7 +378,7 @@ gimp_tile_get (GimpTileBackendPlugin *backend_plugin,
priv->bpp); priv->bpp);
#endif #endif
g_printerr ("received tile info did not match computed tile info"); g_printerr ("received tile info did not match computed tile info");
gimp_quit (); _gimp_quit ();
} }
if (tile_data->use_shm) if (tile_data->use_shm)
@ -394,7 +394,7 @@ gimp_tile_get (GimpTileBackendPlugin *backend_plugin,
if (! gp_tile_ack_write (_gimp_plug_in_get_write_channel (plug_in), if (! gp_tile_ack_write (_gimp_plug_in_get_write_channel (plug_in),
plug_in)) plug_in))
gimp_quit (); _gimp_quit ();
gimp_wire_destroy (&msg); gimp_wire_destroy (&msg);
} }
@ -416,7 +416,7 @@ gimp_tile_put (GimpTileBackendPlugin *backend_plugin,
if (! gp_tile_req_write (_gimp_plug_in_get_write_channel (plug_in), if (! gp_tile_req_write (_gimp_plug_in_get_write_channel (plug_in),
&tile_req, plug_in)) &tile_req, plug_in))
gimp_quit (); _gimp_quit ();
_gimp_plug_in_read_expect_msg (plug_in, &msg, GP_TILE_DATA); _gimp_plug_in_read_expect_msg (plug_in, &msg, GP_TILE_DATA);
@ -444,7 +444,7 @@ gimp_tile_put (GimpTileBackendPlugin *backend_plugin,
if (! gp_tile_data_write (_gimp_plug_in_get_write_channel (plug_in), if (! gp_tile_data_write (_gimp_plug_in_get_write_channel (plug_in),
&tile_data, plug_in)) &tile_data, plug_in))
gimp_quit (); _gimp_quit ();
if (! tile_info->use_shm) if (! tile_info->use_shm)
tile_data.data = NULL; tile_data.data = NULL;