From ce3ae1bf62e38737d2682db8540c66f580a54e42 Mon Sep 17 00:00:00 2001 From: theadib Date: Thu, 27 Dec 2007 00:32:16 +0000 Subject: [PATCH] BUG: 178803: Save As... -> filetype PDF via Cairo crashes --- src/extension/internal/cairo-pdf-out.cpp | 41 ++++++++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/extension/internal/cairo-pdf-out.cpp b/src/extension/internal/cairo-pdf-out.cpp index dd53ff4f6..f6d5918e9 100644 --- a/src/extension/internal/cairo-pdf-out.cpp +++ b/src/extension/internal/cairo-pdf-out.cpp @@ -109,19 +109,46 @@ CairoPdfOutput::save (Inkscape::Extension::Output *mod, SPDocument *doc, const g if (ext == NULL) return; - bool old_textToPath = ext->get_param_bool("textToPath"); - bool new_textToPath = mod->get_param_bool("textToPath"); - ext->set_param_bool("textToPath", new_textToPath); + bool old_textToPath = FALSE; + bool new_textToPath = FALSE; + try { + old_textToPath = ext->get_param_bool("textToPath"); + new_textToPath = mod->get_param_bool("textToPath"); + ext->set_param_bool("textToPath", new_textToPath); + } + catch(...) { + g_warning("Parameter might not exists"); + } - bool old_blurToBitmap = ext->get_param_bool("blurToBitmap"); - bool new_blurToBitmap = mod->get_param_bool("blurToBitmap"); - ext->set_param_bool("blurToBitmap", new_blurToBitmap); + bool old_blurToBitmap = FALSE; + bool new_blurToBitmap = FALSE; + try { + old_blurToBitmap = ext->get_param_bool("blurToBitmap"); + new_blurToBitmap = mod->get_param_bool("blurToBitmap"); + ext->set_param_bool("blurToBitmap", new_blurToBitmap); + } + catch(...) { + g_warning("Parameter might not exists"); + } gchar * final_name; final_name = g_strdup_printf("> %s", uri); ret = pdf_print_document_to_file(doc, final_name, 0, new_textToPath, new_blurToBitmap); g_free(final_name); + try { + ext->set_param_bool("blurToBitmap", old_blurToBitmap); + } + catch(...) { + g_warning("Parameter might not exists"); + } + try { + ext->set_param_bool("textToPath", old_textToPath); + } + catch(...) { + g_warning("Parameter might not exists"); + } + if (!ret) throw Inkscape::Extension::Output::save_failed(); @@ -146,7 +173,7 @@ CairoPdfOutput::init (void) "\n" "" N_("PDF 1.4") "\n" "\n" - "true\n" + "false\n" "false\n" "\n" ".pdf\n" -- 2.30.2