Bug 1034921 - Remove dangerous public destructor of nsFoo in TestThreadUtils.cpp. r=nfroyd

This commit is contained in:
Anuj Agarwal 2014-09-04 07:07:00 +02:00
Родитель 6b7ffc4559
Коммит 09aa8919f5
1 изменённых файлов: 3 добавлений и 11 удалений

Просмотреть файл

@ -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