Closed Bug 387096 Opened 17 years ago Closed 11 years ago

A nsIZipEntry can't be used anymore after nsIZipReader.close()

Categories

(Core :: Networking: JAR, defect)

x86
Linux
defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla22

People

(Reporter: Yoric, Assigned: Cykesiopka)

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20070602 Firefox/2.0.0.4 (Swiftfox) XPCOMViewer/0.9.5
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20070602 Firefox/2.0.0.4 (Swiftfox) XPCOMViewer/0.9.5

In my extension, I used the following process:
* open a nsIZipReader from a file
* locate some entry inside that nsIZipReader
* close the nsIZipReader
* use the name of the entry with nsIZipEntry.name .

The result was random bugs, as the nsIZipEntry had been deallocated by nsIZipReader.close(), although it was still referenced.

I don't think it's a big issue *provided the documentation is clarified*. 

Suggested change:
Change
    /**
     * Closes a zip reader. Subsequent attempts to extract files or read from
     * its input stream will result in an error.
     */
to
    /**
     * Closes a zip reader. Subsequent attempts to extract files or read from
     * its input stream will result in an error. 
     *
     * Subsequent attempts to access a nsIZipEntry obtained from this zip
     * reader will cause unspecified behavior.
     */


Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Component: XPCOM → Networking: JAR
Attached patch Proposed Patch (obsolete) — Splinter Review
Attachment #722148 - Flags: review?(dteller)
Comment on attachment 722148 [details] [diff] [review]
Proposed Patch

Review of attachment 722148 [details] [diff] [review]:
-----------------------------------------------------------------

I had completely forgotten about that bug.
Thanks for the docfix.

Could you also update https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIZipReader#close%28%29 ?
Attachment #722148 - Flags: review?(dteller) → review+
(In reply to David Rajchenbach Teller [:Yoric] from comment #2)
> Comment on attachment 722148 [details] [diff] [review]
> Proposed Patch
> 
> Review of attachment 722148 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I had completely forgotten about that bug.
> Thanks for the docfix.
> 
> Could you also update
> https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/
> nsIZipReader#close%28%29 ?

Done.
Assignee: nobody → cykesiopka
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #722148 - Attachment is obsolete: true
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/31b28458cee6
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: