MediaCache: Add safety check to Close()

This commit is contained in:
Pale Moon
2016-12-07 02:54:36 +01:00
committed by roytam1
parent 244d598c81
commit 3b8a1bc094
+8 -6
View File
@@ -1984,12 +1984,14 @@ MediaCacheStream::Close()
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
CloseInternal(mon);
// Queue an Update since we may have created more free space. Don't do
// it from CloseInternal since that gets called by Update() itself
// sometimes, and we try to not to queue updates from Update().
gMediaCache->QueueUpdate();
if (gMediaCache) {
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
CloseInternal(mon);
// Queue an Update since we may have created more free space. Don't do
// it from CloseInternal since that gets called by Update() itself
// sometimes, and we try to not to queue updates from Update().
gMediaCache->QueueUpdate();
}
}
void