Closed
Bug 757946
Opened 12 years ago
Closed 12 years ago
nsConverterOutputStream logs "WARNING: Flush() lost data!" at close if underlying stream is already closed
Categories
(Core :: Internationalization, defect)
Core
Internationalization
Tracking
()
RESOLVED
FIXED
mozilla15
People
(Reporter: Irving, Assigned: Irving)
Details
Attachments
(1 file)
1010 bytes,
patch
|
smontagu
:
review+
|
Details | Diff | Splinter Review |
The warning is frightening but harmless; the sequence of events that brought this on are: JS code creates an nsISafeOutputStream to write safely to a file, then wraps that stream in a nsIConverterOutputStream Once all the bytes are written through the converter, the JS code calls ConverterOutputStream.flush() and then SafeOutputStream.finish() to close and rename the underlying file to its final name. The JS code *cannot* just call ConverterOutputStream.close(), because calling close() on the SafeOutputStream aborts the file save operation; the temporary is only moved into its final position if finish() is called. So, the underlying OutputStream is closed but the ConverterOutputStream is not. Then, when JS GC destroys the ConverterOutputStream, the destructor calls close(), which calls flush(), which always tries to write() to the underlying OutputStream even if it doesn't have anything to write. I'll attach a patch for that issue, but it would also be worth making nsIConverterOutputStream implement the nsISafeOutputStream API so that calling code could just finish() the ConverterOutputStream and have the right things happen all the way down.
Assignee | ||
Comment 1•12 years ago
|
||
Attachment #626541 -
Flags: review?(smontagu)
Updated•12 years ago
|
Attachment #626541 -
Flags: review?(smontagu) → review+
Assignee | ||
Updated•12 years ago
|
Keywords: checkin-needed
Comment 2•12 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/ea68a0638211
Keywords: checkin-needed
Target Milestone: --- → mozilla15
Comment 3•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/ea68a0638211
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•