Closed
Bug 6084
Opened 26 years ago
Closed 25 years ago
Lack of error handling in nsIFileWidget calls
Categories
(Core Graveyard :: Tracking, defect, P3)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: sfraser_bugs, Assigned: rods)
Details
nsIFileWidget is used in a number of places for opening/saving files. In the
two cases that I've notice so far, there is absolutely no error checking
to test whether the component manager actually managed to create a
file widget. So the code looks like:
nsIFileWidget* fileWidget;
nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID,
(void**)&fileWidget);
fileWidget->SetFilterList(5, titles, filters);
This is lack of error handling is appalling; in a componentized world such as
ours, who knows what trivial user error could result in the component manager
being unable to create an instance of something. Check return values, please!
If error-checking code isn't in the woods, and a call doesn't fail, does anybody
not hear it?
The code is broken; I'll fix it. But let the record show I didn't write the
original version (I did copy the bad version into some of my code though, so I
feel worse about that).
Assignee: law → rods
Status: ASSIGNED → NEW
Component: XP Toolkit/Widgets → other
Assignee | ||
Comment 3•26 years ago
|
||
I copied the code from elsewhere also, and feel as bad a Bill.... I'll track
down the origin and fix it, and promise to do a better job when copied other
people's code.
Bill, did you fix this or do you want me to?
Assignee | ||
Updated•26 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 4•26 years ago
|
||
I have fixed it, I check it in when the tree opens.
Assignee | ||
Updated•25 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 5•25 years ago
|
||
Added the error handle in OnSave(), and OpenWindow()
i did a search on the source tree and found two files that appeared
to have said error checking updated -- (cvs version 1.89)
nsBrowserAppCore.cpp line 1297 nsFileDownloadDialog::OnSave()
nsBrowserAppCore.cpp line 1594 nsFileDownloadDialog::OpenWindow()
marking verified
Reopening. The error handling (and leak removal) went in to OpenWindow(), but not
into OnSave().
Assignee | ||
Updated•25 years ago
|
Status: REOPENED → ASSIGNED
Assignee | ||
Comment 8•25 years ago
|
||
I guess that is a matter of opinion, I will change it to check the error code,
but the current code checks to see if the filewidget is not null, so it is error
checking and it is safe.
Assignee | ||
Updated•25 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 25 years ago → 25 years ago
Assignee | ||
Comment 9•25 years ago
|
||
The OnSave method got removed by law.
Comment 10•25 years ago
|
||
so can i mark this bug VERIFIED?
Comment 11•25 years ago
|
||
Yes, you can mark this verified; the code mentioned here is obsolete.
Comment 12•25 years ago
|
||
thanks! VERIFIED it is.
Updated•8 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•