Bug 1409249: Follow-up: Fix libjar ref counting bustage. r=bustage
authorKris Maglione <maglione.k@gmail.com>
Wed, 25 Oct 2017 23:05:02 -0700
changeset 388276 2b219c2cb0d6ca49ef1cc419756ccdee430f0258
parent 388275 7934163af2749bc58d42e4d99117a6542383b5b8
child 388277 bfad7e6d61909bf3a1879454d64652950fb6ddb5
child 388627 aa958b29c149a67fce772f8473e9586e71fbdb46
push id96607
push usermaglione.k@gmail.com
push dateThu, 26 Oct 2017 06:05:28 +0000
treeherdermozilla-inbound@2b219c2cb0d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
bugs1409249
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1409249: Follow-up: Fix libjar ref counting bustage. r=bustage MozReview-Commit-ID: IbazBuzLGvN
modules/libjar/nsJARProtocolHandler.cpp
--- a/modules/libjar/nsJARProtocolHandler.cpp
+++ b/modules/libjar/nsJARProtocolHandler.cpp
@@ -68,16 +68,18 @@ nsJARProtocolHandler::GetSingleton()
 {
     if (!gJarHandler) {
         auto jar = MakeRefPtr<nsJARProtocolHandler>();
         gJarHandler = jar.get();
         if (NS_FAILED(jar->Init())) {
             gJarHandler = nullptr;
             return nullptr;
         }
+        // We release this reference on module shutdown.
+        NS_ADDREF(gJarHandler);
         return jar.forget();
     }
     return do_AddRef(gJarHandler);
 }
 
 NS_IMETHODIMP
 nsJARProtocolHandler::GetJARCache(nsIZipReaderCache* *result)
 {