File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -367,7 +367,7 @@ void StatisticsBackendData::stop_monitor(
367
367
368
368
// The monitor is inactive
369
369
// NOTE: for test sake, this is not always set
370
- if (database_->is_entity_present (monitor_id))
370
+ if (database_ && database_ ->is_entity_present (monitor_id))
371
371
{
372
372
database_->change_entity_status (monitor_id, false );
373
373
}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class is_active_tests : public ::testing::Test
36
36
37
37
void SetUp ()
38
38
{
39
- db = new DataBaseTest;
39
+ db = new DataBaseTest; // This will be deleted inside StatisticsBackendTest unset_database
40
40
DatabaseDump dump;
41
41
load_file (EMPTY_ENTITIES_DUMP_FILE, dump);
42
42
db->load_database (dump);
@@ -106,6 +106,7 @@ class is_active_tests : public ::testing::Test
106
106
delete entity_queue;
107
107
delete data_queue;
108
108
delete participant_listener;
109
+ StatisticsBackendTest::unset_database ();
109
110
}
110
111
111
112
std::shared_ptr<Host> host;
@@ -121,13 +122,13 @@ class is_active_tests : public ::testing::Test
121
122
DataBaseTest* db;
122
123
123
124
// Entity queue, attached to the database
124
- DatabaseEntityQueue* entity_queue;
125
+ DatabaseEntityQueue* entity_queue = nullptr ;
125
126
// Data queue, attached to the database
126
- DatabaseDataQueue* data_queue;
127
+ DatabaseDataQueue* data_queue = nullptr ;
127
128
// Statistics participant_, that is supposed to receive the callbacks
128
129
eprosima::fastdds::dds::DomainParticipant statistics_participant;
129
130
// Listener under tests. Will receive a pointer to statistics_participant
130
- StatisticsParticipantListener* participant_listener;
131
+ StatisticsParticipantListener* participant_listener = nullptr ;
131
132
};
132
133
133
134
// Windows dll do not export ParticipantProxyData class members (private APIs)
Original file line number Diff line number Diff line change @@ -636,6 +636,10 @@ class StatisticsBackendTest : public StatisticsBackend
636
636
}
637
637
}
638
638
639
+ static void unset_database ()
640
+ {
641
+ details::StatisticsBackendData::get_instance ()->database_ .reset ();
642
+ }
639
643
};
640
644
641
645
/* *
You can’t perform that action at this time.
0 commit comments