Fix some stack-use-after-scopes found by ASan (flutter/engine#28147)
Fixes for Embedder and RefCounted tests.
This commit is contained in:
@@ -472,13 +472,15 @@ TEST(RefCountedTest, SelfAssignment) {
|
||||
|
||||
TEST(RefCountedTest, Swap) {
|
||||
MyClass* created1 = nullptr;
|
||||
bool was_destroyed1 = false;
|
||||
static bool was_destroyed1;
|
||||
was_destroyed1 = false;
|
||||
RefPtr<MyClass> r1(MakeRefCounted<MyClass>(&created1, &was_destroyed1));
|
||||
EXPECT_TRUE(created1);
|
||||
EXPECT_EQ(created1, r1.get());
|
||||
|
||||
MyClass* created2 = nullptr;
|
||||
bool was_destroyed2 = false;
|
||||
static bool was_destroyed2;
|
||||
was_destroyed2 = false;
|
||||
RefPtr<MyClass> r2(MakeRefCounted<MyClass>(&created2, &was_destroyed2));
|
||||
EXPECT_TRUE(created2);
|
||||
EXPECT_EQ(created2, r2.get());
|
||||
|
||||
@@ -2018,7 +2018,8 @@ TEST_F(EmbedderTest,
|
||||
|
||||
constexpr size_t frames_expected = 10;
|
||||
fml::CountDownLatch frame_latch(frames_expected);
|
||||
size_t frames_seen = 0;
|
||||
static size_t frames_seen;
|
||||
frames_seen = 0;
|
||||
context.AddNativeCallback("SignalNativeTest",
|
||||
CREATE_NATIVE_ENTRY([&](Dart_NativeArguments args) {
|
||||
frames_seen++;
|
||||
@@ -2056,7 +2057,8 @@ TEST_F(EmbedderTest,
|
||||
|
||||
constexpr size_t frames_expected = 10;
|
||||
fml::CountDownLatch frame_latch(frames_expected);
|
||||
size_t frames_seen = 0;
|
||||
static size_t frames_seen;
|
||||
frames_seen = 0;
|
||||
context.AddNativeCallback("SignalNativeTest",
|
||||
CREATE_NATIVE_ENTRY([&](Dart_NativeArguments args) {
|
||||
frames_seen++;
|
||||
|
||||
Reference in New Issue
Block a user