Closed Bug 707864 Opened 13 years ago Closed 8 years ago

select to print with no printers installed results in app crash

Categories

(Core :: Printing: Setup, defect)

x86
OS/2
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: lars.erdmann, Unassigned)

References

Details

Attachments

(1 file)

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 ()

}
Forgot:
if (!printerName.IsEmpty())
{
    aDefaultPrinterName = ToNewUnicode(nsDependentString(printerName.Elements()));
}
else
{
    aDefaultPrinterName = NULL;
}
OS: Windows XP → OS/2
or rather (judging from the Windows implementation):
if (!printerName.IsEmpty())
{
    aDefaultPrinterName = ToNewUnicode(nsDependentString(printerName.Elements()));
}
else
{
    aDefaultPrinterName = "";
}
Attached file Stack trace (trap log)
Blocks: 415522
Component: XUL → Printing: Setup
QA Contact: xptoolkit.widgets → printing.setup
Blocks: 377497
OS: OS/2 → Windows XP
OS: Windows XP → OS/2
No longer blocks: 377497
OS/2 is no longer a supported platform.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: