As a security precaution, we have turned on the setting "Require API key authentication for API requests" for everyone. If this has broken something, please contact
Last Comment Bug 707864 - select to print with no printers installed results in app crash
: select to print with no printers installed results in app crash
Product: Core
Classification: Components
Component: Printing: Setup (show other bugs)
: unspecified
: x86 OS/2
: -- normal with 1 vote (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
: Jet Villegas (:jet)
: 377497 (view as bug list)
Depends on:
Blocks: 415522
  Show dependency treegraph
Reported: 2011-12-05 19:01 PST by Erdmann
Modified: 2016-07-01 08:11 PDT (History)
6 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Stack trace (trap log) (115.06 KB, text/plain)
2011-12-05 19:27 PST, Erdmann
no flags Details

Description User image Erdmann 2011-12-05 19:01:54 PST
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

Steps to reproduce:

press print button (with no printer installed)

Actual results:

application crash

Expected results:

Error is in mozilla/widget/src/os2/nsDeviceContextSpecOS2.cpp#653 as a check is missing on if any printers are installed at all (derefencing "Elements" of a nsTArray is not allowed if array is empty).
I suggest:

void GlobalPrinters::GetDefaultPrinterName(PRUnichar*& aDefaultPrinterName)
nsAutoChar16Buffer printerName;
PRInt32 printerNameLength;
MultiByteToWideChar(0, printer, strlen(printer), printerName,
if (!printerName.IsEmpty())
    aDefaultPrinterName = ToNewUnicode(nsDependentString(printerName.Elements()));

Same holds true (analogous) for this member function:
nsresult GlobalPrinters::InitializeGlobalPrinters ()

Comment 1 User image Erdmann 2011-12-05 19:04:19 PST
if (!printerName.IsEmpty())
    aDefaultPrinterName = ToNewUnicode(nsDependentString(printerName.Elements()));
    aDefaultPrinterName = NULL;
Comment 2 User image Erdmann 2011-12-05 19:07:56 PST
or rather (judging from the Windows implementation):
if (!printerName.IsEmpty())
    aDefaultPrinterName = ToNewUnicode(nsDependentString(printerName.Elements()));
    aDefaultPrinterName = "";
Comment 3 User image Erdmann 2011-12-05 19:27:05 PST
Created attachment 579198 [details]
Stack trace (trap log)
Comment 4 User image Robert Kaiser 2012-07-05 12:33:15 PDT
*** Bug 377497 has been marked as a duplicate of this bug. ***
Comment 5 User image Wayne Mery (:wsmwk, NI for questions) 2016-07-01 08:11:44 PDT
OS/2 is no longer a supported platform.

Note You need to log in before you can comment on or make changes to this bug.