|
|
999e5e2 |
From beee2792720f5a55820b9ce8df94d985c6d139d0 Mon Sep 17 00:00:00 2001
|
|
|
999e5e2 |
From: Filippo Argiolas <filippo.argiolas@gmail.com>
|
|
|
999e5e2 |
Date: Wed, 24 Mar 2010 08:52:13 +0100
|
|
|
999e5e2 |
Subject: [PATCH] countdown: move rsvg_init and rsvg_term into main
|
|
|
999e5e2 |
|
|
|
999e5e2 |
Initialize rsvg at startup and clean it up at exit.
|
|
|
999e5e2 |
rsvg_term is particularly subtle as it calls xmlCleanupParser()
|
|
|
999e5e2 |
triggering nasty crashes (e.g. with PulseAudio) with multithread
|
|
|
999e5e2 |
applications.
|
|
|
999e5e2 |
See http://0pointer.de/blog/projects/beware-of-rsvg-term.html for more
|
|
|
999e5e2 |
info.
|
|
|
999e5e2 |
Rsvg loading seems to work even without these functions so I'm not sure
|
|
|
999e5e2 |
it's worth to keep them.
|
|
|
999e5e2 |
|
|
|
999e5e2 |
https://bugzilla.gnome.org/show_bug.cgi?id=592100
|
|
|
999e5e2 |
---
|
|
|
999e5e2 |
libcheese/cheese-countdown.c | 3 ---
|
|
|
999e5e2 |
src/cheese.c | 10 ++++++++++
|
|
|
999e5e2 |
2 files changed, 10 insertions(+), 3 deletions(-)
|
|
|
999e5e2 |
|
|
|
999e5e2 |
diff --git a/libcheese/cheese-countdown.c b/libcheese/cheese-countdown.c
|
|
|
999e5e2 |
index b2782e2..d849594 100644
|
|
|
999e5e2 |
--- a/libcheese/cheese-countdown.c
|
|
|
999e5e2 |
+++ b/libcheese/cheese-countdown.c
|
|
|
999e5e2 |
@@ -504,8 +504,6 @@ create_surface_from_svg (GtkWidget *widget, gchar *pcFilename)
|
|
|
999e5e2 |
|
|
|
999e5e2 |
CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (widget);
|
|
|
999e5e2 |
|
|
|
999e5e2 |
- rsvg_init ();
|
|
|
999e5e2 |
-
|
|
|
999e5e2 |
/* load svg-file from disk */
|
|
|
999e5e2 |
pSvgHandle = rsvg_handle_new_from_file (pcFilename, &pError);
|
|
|
999e5e2 |
if (!pSvgHandle)
|
|
|
999e5e2 |
@@ -546,7 +544,6 @@ create_surface_from_svg (GtkWidget *widget, gchar *pcFilename)
|
|
|
999e5e2 |
|
|
|
999e5e2 |
/* clean up */
|
|
|
999e5e2 |
rsvg_handle_free (pSvgHandle);
|
|
|
999e5e2 |
- rsvg_term ();
|
|
|
999e5e2 |
cairo_destroy (pContext);
|
|
|
999e5e2 |
|
|
|
999e5e2 |
return pSurface;
|
|
|
999e5e2 |
diff --git a/src/cheese.c b/src/cheese.c
|
|
|
999e5e2 |
index 5e1c952..f143ecf 100644
|
|
|
999e5e2 |
--- a/src/cheese.c
|
|
|
999e5e2 |
+++ b/src/cheese.c
|
|
|
999e5e2 |
@@ -110,6 +110,10 @@ main (int argc, char **argv)
|
|
|
999e5e2 |
g_thread_init (NULL);
|
|
|
999e5e2 |
gdk_threads_init ();
|
|
|
999e5e2 |
|
|
|
999e5e2 |
+ /* initialize rsvg */
|
|
|
999e5e2 |
+ /* needed to load the camera icon for the countdown widget */
|
|
|
999e5e2 |
+ rsvg_init ();
|
|
|
999e5e2 |
+
|
|
|
999e5e2 |
g_set_application_name (_("Cheese"));
|
|
|
999e5e2 |
|
|
|
999e5e2 |
context = g_option_context_new (N_("- Take photos and videos with your webcam, with fun graphical effects"));
|
|
|
999e5e2 |
@@ -159,5 +163,11 @@ main (int argc, char **argv)
|
|
|
999e5e2 |
gtk_main ();
|
|
|
999e5e2 |
gdk_threads_leave ();
|
|
|
999e5e2 |
|
|
|
999e5e2 |
+ /* cleanup rsvg */
|
|
|
999e5e2 |
+ /* Note: this function is bad with multithread applications as it
|
|
|
999e5e2 |
+ * calls xmlCleanupParser() and should be only called right before
|
|
|
999e5e2 |
+ * exit */
|
|
|
999e5e2 |
+ rsvg_term ();
|
|
|
999e5e2 |
+
|
|
|
999e5e2 |
return 0;
|
|
|
999e5e2 |
}
|
|
|
999e5e2 |
--
|
|
|
999e5e2 |
1.6.6.1
|