Closed Bug 265925 Opened 20 years ago Closed 11 years ago

String usage in nsDeviceContextSpecGTK.cpp is wrong

Categories

(Core :: Printing: Output, defect)

All
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: roland.mainz, Unassigned)

Details

[Per bz's IRC comments about bug 262287]
The string usage in nsDeviceContextSpec(GTK|Xlib|Qt).cpp is weired, maybe even
wrong.

Example:
-- snip --
+NS_IMETHODIMP nsDeviceContextSpecGTK::GetPaperName( const char **aPaperName )
+{
+ *aPaperName = mPaperName;
+ return NS_OK;
+}
-- snip --
This should generate a copy of the string and the consumers should use
getterCopies() and nsXPIDLStrings.
Assignee: roland.mainz → nobody
QA Contact: printing
Summary: String usage in nsDeviceContextSpec(GTK|Xlib|Qt).cpp is wrong → String usage in nsDeviceContextSpecGTK.cpp is wrong
Whiteboard: [good first bug]
Hi,

I would like to work on this bug. So please assign it to me.


Thanks in Advance,

Regards,
A.Anup.
Hi Anup! Thanks for your interest.  As it turns out, I'm pretty sure this bug here is no longer an issue. A lot of print-related code has undergone significant rewrites since this bug was filed in 2004, and it looks like the function mentioned in comment 1 has moved here:

507 /* attribute wstring paperName; */
508 NS_IMETHODIMP
509 nsPrintSettingsGTK::GetPaperName(PRUnichar * *aPaperName)
510 {
511   NS_ENSURE_ARG_POINTER(aPaperName);
512   *aPaperName = ToNewUnicode(NS_ConvertUTF8toUTF16(gtk_paper_size_get_name(mPaperSize)));
513   return NS_OK;
514 }
http://mxr.mozilla.org/mozilla-central/source/widget/gtk2/nsPrintSettingsGTK.cpp#507

...and it now does do string-copying, as Comment 0 suggests we should do.

So: I'm resolving this as WORKSFORME, since it no longer seems to be an issue. If there are other remaining issues of this sort, we should probably just file new bugs for them, rather than covering them in this 9-years-old vaguely-defined bug. :)

In the meantime, Anup: feel free look for another good first bug, at http://www.joshmatthews.net/bugsahoy/ , and thanks again for your interest!
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Whiteboard: [good first bug]
You need to log in before you can comment on or make changes to this bug.