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