Commit 921f00c1 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

unref the gimp object after dumping the configuration as a test for

2003-11-17  Sven Neumann  <sven@gimp.org>

	* app/main.c: unref the gimp object after dumping the
	configuration as a test for Gimp::finalize.

	* app/base/base.[ch]: keep a reference on the config object.
	Renamed parameter "use_mmx" to "use_cpu_accel".

	* app/core/gimp.[ch]: call base_init() and base_exit() from
	app_procs.c, not from the Gimp object.

	* app/app_procs.[ch]: renamed app_init() to app_run() since here's
	where the main loop is run. Actually quit the main loop in
	app_exit_after_callback() instead of just calling exit().

	* app/errors.[ch]: declared fatal error handlers as G_GNUC_NORETURN.

	* libgimp/gimp.h: fixed usage of G_GNUC_NORETURN.
parent 8462016e
2003-11-17 Sven Neumann <sven@gimp.org>
* app/main.c: unref the gimp object after dumping the
configuration as a test for Gimp::finalize.
* app/base/base.[ch]: keep a reference on the config object.
Renamed parameter "use_mmx" to "use_cpu_accel".
* app/core/gimp.[ch]: call base_init() and base_exit() from
app_procs.c, not from the Gimp object.
* app/app_procs.[ch]: renamed app_init() to app_run() since here's
where the main loop is run. Actually quit the main loop in
app_exit_after_callback() instead of just calling exit().
* app/errors.[ch]: declared fatal error handlers as G_GNUC_NORETURN.
* libgimp/gimp.h: fixed usage of G_GNUC_NORETURN.
2003-11-16 Henrik Brix Andersen <brix@gimp.org>
* app/config/gimpguiconfig.c (DEFAULT_WEB_BROWSER): changed
......@@ -38,6 +38,8 @@
#include "config/gimprc.h"
#include "base/base.h"
#include "core/gimp.h"
#include "file/file-open.h"
......@@ -67,7 +69,9 @@ static gboolean app_exit_after_callback (Gimp *gimp,
/* private variables */
static Gimp *the_gimp = NULL;
static Gimp *the_gimp = NULL;
static GMainLoop *loop = NULL;
/* public functions */
......@@ -80,23 +84,23 @@ app_gui_libs_init (gint *argc,
}
void
app_init (const gchar *full_prog_name,
gint gimp_argc,
gchar **gimp_argv,
const gchar *alternate_system_gimprc,
const gchar *alternate_gimprc,
const gchar *session_name,
const gchar **batch_cmds,
gboolean no_interface,
gboolean no_data,
gboolean no_fonts,
gboolean no_splash,
gboolean no_splash_image,
gboolean be_verbose,
gboolean use_shm,
gboolean use_mmx,
gboolean console_messages,
GimpStackTraceMode stack_trace_mode)
app_run (const gchar *full_prog_name,
gint gimp_argc,
gchar **gimp_argv,
const gchar *alternate_system_gimprc,
const gchar *alternate_gimprc,
const gchar *session_name,
const gchar **batch_cmds,
gboolean no_interface,
gboolean no_data,
gboolean no_fonts,
gboolean no_splash,
gboolean no_splash_image,
gboolean be_verbose,
gboolean use_shm,
gboolean use_cpu_accel,
gboolean console_messages,
GimpStackTraceMode stack_trace_mode)
{
GimpInitStatusFunc update_status_func = NULL;
......@@ -201,10 +205,10 @@ app_init (const gchar *full_prog_name,
}
}
gimp_load_config (the_gimp,
alternate_system_gimprc,
alternate_gimprc,
use_mmx);
gimp_load_config (the_gimp, alternate_system_gimprc, alternate_gimprc);
/* initialize lowlevel stuff */
base_init (GIMP_BASE_CONFIG (the_gimp->config), use_cpu_accel);
if (! no_interface)
update_status_func = gui_init (the_gimp, no_splash, no_splash_image);
......@@ -297,8 +301,6 @@ app_init (const gchar *full_prog_name,
if (no_interface)
{
GMainLoop *loop;
loop = g_main_loop_new (NULL, FALSE);
gimp_threads_leave (the_gimp);
......@@ -313,6 +315,9 @@ app_init (const gchar *full_prog_name,
gtk_main ();
}
g_object_unref (the_gimp);
base_exit ();
}
......@@ -332,13 +337,10 @@ app_exit_after_callback (Gimp *gimp,
if (gimp->be_verbose)
g_print ("EXIT: app_exit_after_callback\n");
g_object_unref (gimp);
the_gimp = NULL;
/* There used to be foo_main_quit() here, but there's a chance
* that foo_main() was never called before we reach this point. --Sven
*/
exit (0);
if (loop)
g_main_loop_quit (loop);
else
gtk_main_quit ();
return FALSE;
}
......@@ -28,7 +28,7 @@
gboolean app_gui_libs_init (gint *gimp_argc,
gchar ***gimp_argv);
void app_init (const gchar *full_prog_name,
void app_run (const gchar *full_prog_name,
gint gimp_argc,
gchar **gimp_argv,
const gchar *alternate_system_gimprc,
......@@ -42,7 +42,7 @@ void app_init (const gchar *full_prog_name,
gboolean no_splash_image,
gboolean be_verbose,
gboolean use_shm,
gboolean use_mmx,
gboolean use_cpu_accel,
gboolean console_messages,
GimpStackTraceMode stack_trace_mode);
......
......@@ -60,7 +60,7 @@ static void base_tile_cache_size_notify (GObject *config,
void
base_init (GimpBaseConfig *config,
gboolean use_mmx)
gboolean use_cpu_accel)
{
gchar *swapfile;
gchar *swapdir;
......@@ -69,7 +69,7 @@ base_init (GimpBaseConfig *config,
g_return_if_fail (GIMP_IS_BASE_CONFIG (config));
g_return_if_fail (base_config == NULL);
base_config = config;
base_config = g_object_ref (config);
tile_cache_init (config->tile_cache_size);
......@@ -95,14 +95,17 @@ base_init (GimpBaseConfig *config,
g_free (path);
/* FIXME: pass use_cpu_accel to GimpComposite */
gimp_composite_init ();
paint_funcs_setup (use_mmx);
paint_funcs_setup (use_cpu_accel);
}
void
base_exit (void)
{
g_return_if_fail (base_config != NULL);
swapping_free ();
paint_funcs_free ();
tile_swap_exit ();
......@@ -112,6 +115,7 @@ base_exit (void)
base_tile_cache_size_notify,
NULL);
g_object_unref (base_config);
base_config = NULL;
}
......
......@@ -20,7 +20,7 @@
#define __BASE_H__
void base_init (GimpBaseConfig *config,
gboolean use_mmx);
gboolean use_cpu_accel);
void base_exit (void);
......
......@@ -31,8 +31,6 @@
#include "config/gimpconfig-path.h"
#include "config/gimprc.h"
#include "base/base.h"
#include "pdb/procedural_db.h"
#include "pdb/internal_procs.h"
......@@ -479,8 +477,6 @@ gimp_finalize (GObject *object)
if (gimp->user_units)
gimp_units_exit (gimp);
base_exit ();
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -819,8 +815,7 @@ gimp_edit_config_notify (GObject *edit_config,
void
gimp_load_config (Gimp *gimp,
const gchar *alternate_system_gimprc,
const gchar *alternate_gimprc,
gboolean use_cpu_accel)
const gchar *alternate_gimprc)
{
GimpRc *gimprc;
......@@ -840,9 +835,6 @@ gimp_load_config (Gimp *gimp,
alternate_gimprc,
gimp->be_verbose);
/* initialize lowlevel stuff */
base_init (GIMP_BASE_CONFIG (gimprc), use_cpu_accel);
gimp->config = GIMP_CORE_CONFIG (gimprc);
gimp->edit_config = gimp_config_duplicate (GIMP_CONFIG (gimp->config));
......
......@@ -220,8 +220,7 @@ Gimp * gimp_new (const gchar *name,
void gimp_load_config (Gimp *gimp,
const gchar *alternate_system_gimprc,
const gchar *alternate_gimprc,
gboolean use_cpu_accel);
const gchar *alternate_gimprc);
void gimp_initialize (Gimp *gimp,
GimpInitStatusFunc status_callback);
void gimp_restore (Gimp *gimp,
......
......@@ -50,9 +50,9 @@ static gchar *full_prog_name = NULL;
/* local function prototypes */
static void gimp_eek (const gchar *reason,
const gchar *message,
gboolean use_handler);
static G_GNUC_NORETURN void gimp_eek (const gchar *reason,
const gchar *message,
gboolean use_handler);
/* public functions */
......
......@@ -24,23 +24,23 @@
#endif
void gimp_errors_init (const gchar *full_prog_name,
gboolean use_debug_handler,
GimpStackTraceMode stack_trace_mode);
void gimp_message_log_func (const gchar *log_domain,
GLogLevelFlags flags,
const gchar *message,
gpointer data);
void gimp_error_log_func (const gchar *domain,
GLogLevelFlags flags,
const gchar *message,
gpointer data);
void gimp_fatal_error (const gchar *message,
...);
void gimp_terminate (const gchar *message,
...);
void gimp_errors_init (const gchar *full_prog_name,
gboolean use_debug_handler,
GimpStackTraceMode stack_trace_mode);
void gimp_message_log_func (const gchar *log_domain,
GLogLevelFlags flags,
const gchar *message,
gpointer data);
void gimp_error_log_func (const gchar *domain,
GLogLevelFlags flags,
const gchar *message,
gpointer data) G_GNUC_NORETURN;
void gimp_fatal_error (const gchar *message,
...) G_GNUC_NORETURN ;
void gimp_terminate (const gchar *message,
...) G_GNUC_NORETURN;
#endif /* __ERRORS_H__ */
......@@ -57,14 +57,14 @@
#ifdef G_OS_WIN32
#include <windows.h>
#else
static void gimp_sigfatal_handler (gint sig_num);
static void gimp_sigchld_handler (gint sig_num);
static void gimp_sigfatal_handler (gint sig_num) G_GNUC_NORETURN;
static void gimp_sigchld_handler (gint sig_num);
#endif
static void gimp_show_version (void);
static void gimp_show_help (const gchar *progname);
static void gimp_text_console_exit (gint status);
static void gimp_show_version (void);
static void gimp_show_help (const gchar *progname);
static void gimp_text_console_exit (gint status) G_GNUC_NORETURN;
/*
......@@ -176,7 +176,8 @@ main (int argc,
if (format)
{
Gimp *gimp;
Gimp *gimp;
gboolean success;
g_type_init ();
......@@ -184,8 +185,11 @@ main (int argc,
units_init (gimp);
gimp_text_console_exit (gimp_config_dump (format) ?
EXIT_SUCCESS : EXIT_FAILURE);
success = gimp_config_dump (format);
g_object_unref (gimp);
gimp_text_console_exit (success ? EXIT_SUCCESS : EXIT_FAILURE);
}
}
}
......@@ -436,23 +440,23 @@ main (int argc,
use_debug_handler,
stack_trace_mode);
app_init (full_prog_name,
argc - 1,
argv + 1,
alternate_system_gimprc,
alternate_gimprc,
session_name,
(const gchar **) batch_cmds,
no_interface,
no_data,
no_fonts,
no_splash,
no_splash_image,
be_verbose,
use_shm,
use_mmx,
console_messages,
stack_trace_mode);
app_run (full_prog_name,
argc - 1,
argv + 1,
alternate_system_gimprc,
alternate_gimprc,
session_name,
(const gchar **) batch_cmds,
no_interface,
no_data,
no_fonts,
no_splash,
no_splash_image,
be_verbose,
use_shm,
use_mmx,
console_messages,
stack_trace_mode);
g_free (batch_cmds);
......
......@@ -172,6 +172,13 @@ all other GIMP Library headers.
@Returns:
<!-- ##### FUNCTION gimp_quit ##### -->
<para>
</para>
<!-- ##### FUNCTION gimp_install_procedure ##### -->
<para>
......
......@@ -212,7 +212,7 @@ gint gimp_main (const GimpPlugInInfo *info,
/* Forcefully causes the gimp library to exit and
* close down its connection to main gimp application.
*/
void G_GNUC_NORETURN gimp_quit (void);
void gimp_quit (void) G_GNUC_NORETURN;
/* Install a procedure in the procedure database.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment