mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 828502 - let nsMainThreadPtrHandle::get() handle nullptrs; r=bholley
This commit is contained in:
parent
2cbbe535c5
commit
163b968cde
@ -129,8 +129,10 @@ public:
|
||||
|
||||
T* get() {
|
||||
// Nobody should be touching the raw pointer off-main-thread.
|
||||
if (MOZ_UNLIKELY(!NS_IsMainThread()))
|
||||
if (MOZ_UNLIKELY(!NS_IsMainThread())) {
|
||||
NS_ERROR("Can't dereference nsMainThreadPtrHolder off main thread");
|
||||
MOZ_CRASH();
|
||||
}
|
||||
return mRawPtr;
|
||||
}
|
||||
|
||||
@ -173,7 +175,14 @@ class nsMainThreadPtrHandle
|
||||
// These all call through to nsMainThreadPtrHolder, and thus implicitly
|
||||
// assert that we're on the main thread. Off-main-thread consumers must treat
|
||||
// these handles as opaque.
|
||||
T* get() { return mPtr.get()->get(); }
|
||||
T* get()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (mPtr) {
|
||||
return mPtr.get()->get();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
operator T*() { return get(); }
|
||||
T* operator->() { return get(); }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user