mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 961325: Give PersistentRooted a copy constructor that can take a 'const' original. r=terrence
This commit is contained in:
parent
2507e06387
commit
7253057ce9
@ -1138,7 +1138,7 @@ class PersistentRooted : private mozilla::LinkedListElement<PersistentRooted<T>
|
||||
registerWithRuntime(rt);
|
||||
}
|
||||
|
||||
PersistentRooted(PersistentRooted &rhs)
|
||||
PersistentRooted(const PersistentRooted &rhs)
|
||||
: mozilla::LinkedListElement<PersistentRooted<T> >(),
|
||||
ptr(rhs.ptr)
|
||||
{
|
||||
@ -1146,8 +1146,11 @@ class PersistentRooted : private mozilla::LinkedListElement<PersistentRooted<T>
|
||||
* Copy construction takes advantage of the fact that the original
|
||||
* is already inserted, and simply adds itself to whatever list the
|
||||
* original was on - no JSRuntime pointer needed.
|
||||
*
|
||||
* This requires mutating rhs's links, but those should be 'mutable'
|
||||
* anyway. C++ doesn't let us declare mutable base classes.
|
||||
*/
|
||||
rhs.setNext(this);
|
||||
const_cast<PersistentRooted &>(rhs).setNext(this);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user