diff options
author | Jory Pratt <anarchy@gentoo.org> | 2011-01-02 21:13:49 +0000 |
---|---|---|
committer | Jory Pratt <anarchy@gentoo.org> | 2011-01-02 21:13:49 +0000 |
commit | 66360c2eea41c5b39e595f4ad95a5113994597ab (patch) | |
tree | 8fafb7dd5f57af5367c7a6d1f567f128f00235dd /mail-client/thunderbird/files | |
parent | Stable on amd64 wrt bug #349516 (diff) | |
download | gentoo-2-66360c2eea41c5b39e595f4ad95a5113994597ab.tar.gz gentoo-2-66360c2eea41c5b39e595f4ad95a5113994597ab.tar.bz2 gentoo-2-66360c2eea41c5b39e595f4ad95a5113994597ab.zip |
Fix segfault when attempting to dlclose cups, bug 325469
(Portage version: 2.1.9.27/cvs/Linux x86_64)
Diffstat (limited to 'mail-client/thunderbird/files')
-rw-r--r-- | mail-client/thunderbird/files/cups-1.4.4-fixup.patch | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/mail-client/thunderbird/files/cups-1.4.4-fixup.patch b/mail-client/thunderbird/files/cups-1.4.4-fixup.patch new file mode 100644 index 000000000000..a0923e8906e9 --- /dev/null +++ b/mail-client/thunderbird/files/cups-1.4.4-fixup.patch @@ -0,0 +1,161 @@ +# HG changeset patch +# User Matthew Gregan <kinetik@flim.org> +# Date 1293624205 -3600 +# Node ID ffa1ef8ab52b4081e27aa2b24d14a550386f90db +# Parent 9e561d402701f46eb56dbadb96b6963f4518cdd0 +Bug 573039 - Construct nsCUPSShim statically and avoid calling PR_UnloadLibrary on libcups after it has been initialized. r=karlt a=clegnitto + +diff --git a/mozilla/gfx/src/psshared/nsCUPSShim.cpp b/mozilla/gfx/src/psshared/nsCUPSShim.cpp +--- a/mozilla/gfx/src/psshared/nsCUPSShim.cpp ++++ b/mozilla/gfx/src/psshared/nsCUPSShim.cpp +@@ -83,14 +83,8 @@ nsCUPSShim::Init() + #endif + PR_UnloadLibrary(mCupsLib); + mCupsLib = nsnull; + return PR_FALSE; + } + } + return PR_TRUE; + } +- +-nsCUPSShim::~nsCUPSShim() +-{ +- if (mCupsLib) +- PR_UnloadLibrary(mCupsLib); +-} +diff --git a/mozilla/gfx/src/psshared/nsCUPSShim.h b/mozilla/gfx/src/psshared/nsCUPSShim.h +--- a/mozilla/gfx/src/psshared/nsCUPSShim.h ++++ b/mozilla/gfx/src/psshared/nsCUPSShim.h +@@ -81,17 +81,16 @@ typedef int (PR_CALLBACK *CupsAddOptionT + int num_options, + cups_option_t **options); + + struct PRLibrary; + + class NS_PSSHARED nsCUPSShim { + public: + nsCUPSShim() : mCupsLib(nsnull) { } +- ~nsCUPSShim(); + + /** + * Initialize this object. Attempt to load the CUPS shared + * library and find function pointers for the supported + * functions (see below). + * @return PR_FALSE if the shared library could not be loaded, or if + * any of the functions could not be found. + * PR_TRUE for successful initialization. +diff --git a/mozilla/gfx/src/psshared/nsPSPrinters.cpp b/mozilla/gfx/src/psshared/nsPSPrinters.cpp +--- a/mozilla/gfx/src/psshared/nsPSPrinters.cpp ++++ b/mozilla/gfx/src/psshared/nsPSPrinters.cpp +@@ -51,32 +51,34 @@ + #include "plstr.h" + + #define NS_CUPS_PRINTER "CUPS/" + #define NS_CUPS_PRINTER_LEN (sizeof(NS_CUPS_PRINTER) - 1) + + /* dummy printer name for the gfx/src/ps driver */ + #define NS_POSTSCRIPT_DRIVER_NAME "PostScript/" + ++nsCUPSShim gCupsShim; ++ + /* Initialize the printer manager object */ + nsresult + nsPSPrinterList::Init() + { + nsresult rv; + + mPrefSvc = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); + if (NS_SUCCEEDED(rv)) + rv = mPrefSvc->GetBranch("print.", getter_AddRefs(mPref)); + NS_ENSURE_SUCCESS(rv, NS_ERROR_NOT_INITIALIZED); + + // Should we try cups? + PRBool useCups = PR_TRUE; + rv = mPref->GetBoolPref("postscript.cups.enabled", &useCups); +- if (useCups) +- mCups.Init(); ++ if (useCups && !gCupsShim.IsInitialized()) ++ gCupsShim.Init(); + return NS_OK; + } + + + /* Check whether the PostScript module has been disabled at runtime */ + PRBool + nsPSPrinterList::Enabled() + { +@@ -94,35 +96,35 @@ nsPSPrinterList::Enabled() + /* Fetch a list of printers handled by the PostsScript module */ + void + nsPSPrinterList::GetPrinterList(nsTArray<nsCString>& aList) + { + aList.Clear(); + + // Query CUPS for a printer list. The default printer goes to the + // head of the output list; others are appended. +- if (mCups.IsInitialized()) { ++ if (gCupsShim.IsInitialized()) { + cups_dest_t *dests; + +- int num_dests = (mCups.mCupsGetDests)(&dests); ++ int num_dests = (gCupsShim.mCupsGetDests)(&dests); + if (num_dests) { + for (int i = 0; i < num_dests; i++) { + nsCAutoString fullName(NS_CUPS_PRINTER); + fullName.Append(dests[i].name); + if (dests[i].instance != NULL) { + fullName.Append("/"); + fullName.Append(dests[i].instance); + } + if (dests[i].is_default) + aList.InsertElementAt(0, fullName); + else + aList.AppendElement(fullName); + } + } +- (mCups.mCupsFreeDests)(num_dests, dests); ++ (gCupsShim.mCupsFreeDests)(num_dests, dests); + } + + // Build the "classic" list of printers -- those accessed by running + // an opaque command. This list always contains a printer named "default". + // In addition, we look for either an environment variable + // MOZILLA_POSTSCRIPT_PRINTER_LIST or a preference setting + // print.printer_list, which contains a space-separated list of printer + // names. +diff --git a/mozilla/gfx/src/psshared/nsPSPrinters.h b/mozilla/gfx/src/psshared/nsPSPrinters.h +--- a/mozilla/gfx/src/psshared/nsPSPrinters.h ++++ b/mozilla/gfx/src/psshared/nsPSPrinters.h +@@ -37,17 +37,16 @@ + * ***** END LICENSE BLOCK ***** */ + + #ifndef nsPSPrinters_h___ + #define nsPSPrinters_h___ + + #include "nsString.h" + #include "nsTArray.h" + #include "prtypes.h" +-#include "nsCUPSShim.h" + #include "psSharedCore.h" + + class nsIPrefService; + class nsIPrefBranch; + class nsCUPSShim; + + class NS_PSSHARED nsPSPrinterList { + public: +@@ -91,12 +90,11 @@ class NS_PSSHARED nsPSPrinterList { + * the <type> portion as described for GetPrinterList(). + * @return The PrinterType value for this name. + */ + static PrinterType GetPrinterType(const nsACString& aName); + + private: + nsCOMPtr<nsIPrefService> mPrefSvc; + nsCOMPtr<nsIPrefBranch> mPref; +- nsCUPSShim mCups; + }; + + #endif /* nsPSPrinters_h___ */ + + |