$OpenBSD: patch-gfx_src_psshared_nsPSPrinters_cpp,v 1.1 2010/12/26 13:16:29 stsp Exp $
https://bugzilla.mozilla.org/show_bug.cgi?id=573039
https://bug573039.bugzilla.mozilla.org/attachment.cgi?id=499233
--- gfx/src/psshared/nsPSPrinters.cpp.orig	Fri Dec  3 16:48:03 2010
+++ gfx/src/psshared/nsPSPrinters.cpp	Sun Dec 26 11:08:25 2010
@@ -45,6 +45,7 @@
 #include "nsPrintfCString.h"
 #include "nsPSPrinters.h"
 #include "nsReadableUtils.h"        // StringBeginsWith()
+#include "nsCUPSShim.h"
 
 #include "prlink.h"
 #include "prenv.h"
@@ -56,6 +57,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 +73,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 +102,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 +120,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
