mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1034921 - Remove dangerous public destructor of nsFoo in TestThreadUtils.cpp. r=nfroyd
This commit is contained in:
parent
2e00e6302e
commit
73746d0f51
@ -31,17 +31,11 @@ class nsFoo : public nsISupports {
|
||||
*aBool = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~nsFoo() {}
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
template<>
|
||||
struct HasDangerousPublicDestructor<nsFoo>
|
||||
{
|
||||
static const bool value = true;
|
||||
};
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS0(nsFoo)
|
||||
|
||||
class TestSuicide : public nsRunnable {
|
||||
@ -129,7 +123,7 @@ int main(int argc, char** argv)
|
||||
|
||||
// This pointer will be freed at the end of the block
|
||||
// Do not dereference this pointer in the runnable method!
|
||||
nsFoo * rawFoo = new nsFoo();
|
||||
nsRefPtr<nsFoo> rawFoo = new nsFoo();
|
||||
|
||||
// Read only string. Dereferencing in runnable method to check this works.
|
||||
char* message = (char*)"Test message";
|
||||
@ -152,8 +146,6 @@ int main(int argc, char** argv)
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArg<nsFoo*>(bar, &nsBar::DoBar5std, rawFoo));
|
||||
NS_DispatchToMainThread(NS_NewRunnableMethodWithArg<char*>(bar, &nsBar::DoBar6std, message));
|
||||
#endif
|
||||
|
||||
delete rawFoo;
|
||||
}
|
||||
|
||||
// Spin the event loop
|
||||
|
Loading…
Reference in New Issue
Block a user