mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1150944 - Remove objects that have been unlinked by the cycle collector from the demotable context list. r=ehsan
This commit is contained in:
parent
9e32407045
commit
e618aa2689
@ -859,6 +859,9 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(CanvasRenderingContext2D)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(CanvasRenderingContext2D)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CanvasRenderingContext2D)
|
||||
// Make sure we remove ourselves from the list of demotable contexts (raw pointers),
|
||||
// since we're logically destructed at this point.
|
||||
CanvasRenderingContext2D::RemoveDemotableContext(tmp);
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCanvasElement)
|
||||
for (uint32_t i = 0; i < tmp->mStyleStack.Length(); i++) {
|
||||
ImplCycleCollectionUnlink(tmp->mStyleStack[i].patternStyles[Style::STROKE]);
|
||||
@ -1238,6 +1241,10 @@ void CanvasRenderingContext2D::Demote()
|
||||
std::vector<CanvasRenderingContext2D*>&
|
||||
CanvasRenderingContext2D::DemotableContexts()
|
||||
{
|
||||
// This is a list of raw pointers to cycle-collected objects. We need to ensure
|
||||
// that we remove elements from it during UNLINK (which can happen considerably before
|
||||
// the actual destructor) since the object is logically destroyed at that point
|
||||
// and will be in an inconsistant state.
|
||||
static std::vector<CanvasRenderingContext2D*> contexts;
|
||||
return contexts;
|
||||
}
|
||||
|
@ -685,6 +685,9 @@ protected:
|
||||
return CurrentState().font;
|
||||
}
|
||||
|
||||
// This function maintains a list of raw pointers to cycle-collected
|
||||
// objects. We need to ensure that no entries persist beyond unlink,
|
||||
// since the objects are logically destructed at that point.
|
||||
static std::vector<CanvasRenderingContext2D*>& DemotableContexts();
|
||||
static void DemoteOldestContextIfNecessary();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user