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.
Does this bug block #69862, or in other words, prevents #69862 to be landed again.
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.
Cc some strong C++ folks
Created attachment 26940 [details] [diff] [review] Patch to declare private copy ctors and assignment operators for stream classes
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.
Good work, you can reassign it to yourself, if you want.
Assignee: naving → sfraser
r=waterson. do you mean to check in the plevent & nsPipe2 instrumentation stuff?
Er, whoops. Overzealous patch. Heed only the changes in nsFileStream.h
setting to moz0.9
Target Milestone: --- → mozilla0.9
Shouldn't these classes be retired, in favor of the implementations in Necko?
They should, but there is way too much code that uses them, and their close ties with the venerable nsFileSpec.
moving to mozilla0.9.1
Target Milestone: mozilla0.9 → mozilla0.9.1
Status: NEW → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED
Fix checked in.
You need to log in before you can comment on or make changes to this bug.