Skip to content

Commit ba1ede8

Browse files
author
Robert Strong
committed
Bug 1044443 - release off main thread crash in nsXPCWrappedJS::Release() via nsUpdateProcessor::~nsUpdateProcessor(). r=bbondy
1 parent 6bf8ed2 commit ba1ede8

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

toolkit/mozapps/update/nsUpdateService.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3530,7 +3530,11 @@ UpdateManager.prototype = {
35303530
}
35313531
},
35323532

3533-
refreshUpdateStatus: function UM_refreshUpdateStatus(update) {
3533+
/**
3534+
* See nsIUpdateService.idl
3535+
*/
3536+
refreshUpdateStatus: function UM_refreshUpdateStatus(aUpdate) {
3537+
var update = this._activeUpdate ? this._activeUpdate : aUpdate;
35343538
var updateSucceeded = true;
35353539
var status = readStatusFile(getUpdatesDir());
35363540
var ary = status.split(":");

toolkit/xre/nsUpdateDriver.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,8 +1170,6 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate)
11701170
}
11711171
#endif
11721172

1173-
mUpdate = aUpdate;
1174-
11751173
MOZ_ASSERT(NS_IsMainThread(), "not main thread");
11761174
return NS_NewThread(getter_AddRefs(mProcessWatcher),
11771175
NS_NewRunnableMethod(this, &nsUpdateProcessor::StartStagedUpdate));
@@ -1215,7 +1213,6 @@ nsUpdateProcessor::ShutdownWatcherThread()
12151213
MOZ_ASSERT(NS_IsMainThread(), "not main thread");
12161214
mProcessWatcher->Shutdown();
12171215
mProcessWatcher = nullptr;
1218-
mUpdate = nullptr;
12191216
}
12201217

12211218
void
@@ -1233,8 +1230,12 @@ nsUpdateProcessor::UpdateDone()
12331230

12341231
nsCOMPtr<nsIUpdateManager> um =
12351232
do_GetService("@mozilla.org/updates/update-manager;1");
1236-
if (um && mUpdate) {
1237-
um->RefreshUpdateStatus(mUpdate);
1233+
if (um) {
1234+
nsCOMPtr<nsIUpdate> update;
1235+
um->GetActiveUpdate(getter_AddRefs(update));
1236+
if (update) {
1237+
um->RefreshUpdateStatus(update);
1238+
}
12381239
}
12391240

12401241
ShutdownWatcherThread();

toolkit/xre/nsUpdateDriver.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ class nsUpdateProcessor MOZ_FINAL : public nsIUpdateProcessor
105105
private:
106106
ProcessType mUpdaterPID;
107107
nsCOMPtr<nsIThread> mProcessWatcher;
108-
nsCOMPtr<nsIUpdate> mUpdate;
109108
StagedUpdateInfo mInfo;
110109
};
111110
#endif

0 commit comments

Comments
 (0)