The default bug view has changed. See this FAQ.

select to print with no printers installed results in app crash

RESOLVED WONTFIX

Status

()

Core
Printing: Setup
RESOLVED WONTFIX
5 years ago
9 months ago

People

(Reporter: Erdmann, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
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,
      printerNameLength);
if (!printerName.IsEmpty())
{
    aDefaultPrinterName = ToNewUnicode(nsDependentString(printerName.Elements()));
}
...

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

}
(Reporter)

Comment 1

5 years ago
Forgot:
if (!printerName.IsEmpty())
{
    aDefaultPrinterName = ToNewUnicode(nsDependentString(printerName.Elements()));
}
else
{
    aDefaultPrinterName = NULL;
}
OS: Windows XP → OS/2
(Reporter)

Comment 2

5 years ago
or rather (judging from the Windows implementation):
if (!printerName.IsEmpty())
{
    aDefaultPrinterName = ToNewUnicode(nsDependentString(printerName.Elements()));
}
else
{
    aDefaultPrinterName = "";
}
(Reporter)

Comment 3

5 years ago
Created attachment 579198 [details]
Stack trace (trap log)

Updated

5 years ago
Blocks: 415522
Component: XUL → Printing: Setup
QA Contact: xptoolkit.widgets → printing.setup

Updated

5 years ago
Blocks: 377497
OS: OS/2 → Windows XP
OS: Windows XP → OS/2

Updated

5 years ago
No longer blocks: 377497
Duplicate of this bug: 377497
OS/2 is no longer a supported platform.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 9 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.