$OpenBSD: patch-mozilla_gfx_src_psshared_nsPSPrinters_cpp,v 1.1 2011/01/05 08:22:30 dcoppa Exp $
--- mozilla/gfx/src/psshared/nsPSPrinters.cpp.orig	Tue Dec  7 17:35:40 2010
+++ mozilla/gfx/src/psshared/nsPSPrinters.cpp	Mon Jan  3 14:54:15 2011
@@ -56,6 +56,8 @@
 /* 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()
@@ -70,8 +72,8 @@ nsPSPrinterList::Init()
     // 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;
 }
 
@@ -99,10 +101,10 @@ nsPSPrinterList::GetPrinterList(nsTArray<nsCString>& a
 
     // 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);
@@ -117,7 +119,7 @@ nsPSPrinterList::GetPrinterList(nsTArray<nsCString>& a
                     aList.AppendElement(fullName);
             }
         }
-        (mCups.mCupsFreeDests)(num_dests, dests);
+        (gCupsShim.mCupsFreeDests)(num_dests, dests);
     }
 
     // Build the "classic" list of printers -- those accessed by running
