Closed
Bug 71064
Opened 25 years ago
Closed 25 years ago
Stream classes should have private, unimplemented copy ctor and assignment operators
Categories
(Core :: XPCOM, defect, P3)
Tracking
()
RESOLVED
FIXED
mozilla0.9.1
People
(Reporter: sfraser_bugs, Assigned: sfraser_bugs)
Details
Attachments
(1 file)
We've had a number of bug recently (in bookmarks, and cookies) where stream
assignments have caused bad things to happen, because of premature file closing.
This happened because streams were being passed by value, not by reference, in a
few places.
I think we should disallow implicit stream assignments by declaring private copy
constructors and operator= on the various stream classes.
Comment 1•25 years ago
|
||
Does this bug block #69862, or in other words, prevents #69862 to be landed again.
| Assignee | ||
Comment 2•25 years ago
|
||
No. Fixing this bug would make it a compile-time error if someone passes a stream
by value, rather than by reference. This means that you can be confident that no
streams are erroneously copied, leading to the problems we saw before.
| Assignee | ||
Comment 3•25 years ago
|
||
Cc some strong C++ folks
| Assignee | ||
Comment 4•25 years ago
|
||
| Assignee | ||
Comment 5•25 years ago
|
||
With this patch, we would have caught pass-by-values of streams in bookmarks and
cookies at compile time. I've built mozilla with these changes, and the fixes for
cookie and bookmarks. I have not yet build a commercial tree.
Comment 6•25 years ago
|
||
Good work, you can reassign it to yourself, if you want.
Comment 8•25 years ago
|
||
r=waterson. do you mean to check in the plevent & nsPipe2 instrumentation stuff?
Comment 9•25 years ago
|
||
sr=scc
| Assignee | ||
Comment 10•25 years ago
|
||
Er, whoops. Overzealous patch. Heed only the changes in nsFileStream.h
Comment 12•25 years ago
|
||
Shouldn't these classes be retired, in favor of the implementations in Necko?
| Assignee | ||
Comment 13•25 years ago
|
||
They should, but there is way too much code that uses them, and their close ties
with the venerable nsFileSpec.
Updated•25 years ago
|
Priority: -- → P3
| Assignee | ||
Updated•25 years ago
|
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 15•25 years ago
|
||
Fix checked in.
You need to log in
before you can comment on or make changes to this bug.
Description
•