[goffice] allow multiple calls to libgoffice_shutdown.



commit 63be0ab03826baea094829db164f0b0c137cb8e3
Author: Jean Brefort <jean brefort normalesup org>
Date:   Mon Dec 7 22:15:47 2009 +0100

    allow multiple calls to libgoffice_shutdown.

 ChangeLog         |    5 +++++
 goffice/goffice.c |    7 ++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1aedcdd..5d8ad5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-07  Jean Brefort  <jean brefort normalesup org>
+
+	* goffice/goffice.c (libgoffice_init), (libgoffice_shutdown): allow
+	multiple calls to libgoffice_shutdown.
+
 2009-12-06  Jean Brefort  <jean brefort normalesup org>
 
 	* goffice/canvas/goc-canvas.c (goc_canvas_invalidate): really pass width
diff --git a/goffice/goffice.c b/goffice/goffice.c
index 0336fbd..114b8e1 100644
--- a/goffice/goffice.c
+++ b/goffice/goffice.c
@@ -86,12 +86,11 @@ go_sys_lib_dir (void)
 	return libgoffice_lib_dir;
 }
 
+static int initialized = 0;
 void
 libgoffice_init (void)
 {
-	static gboolean initialized = FALSE;
-
-	if (initialized)
+	if (initialized++)
 		return;
 
 #ifdef G_OS_WIN32
@@ -165,6 +164,8 @@ libgoffice_init (void)
 void
 libgoffice_shutdown (void)
 {
+	if (--initialized)
+		return;
 	_gog_themes_shutdown ();
 	_go_fonts_shutdown ();
 	_go_conf_shutdown ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]