init shared_data in the purpose=QUERY case to prevent crash. Also don't load zones if we don't need them
This commit is contained in:
parent
14894dfb00
commit
cc24df9593
|
@ -492,6 +492,8 @@ Monitor::Monitor(
|
|||
shared_data->last_read_time = 0;
|
||||
shared_data->alarm_x = -1;
|
||||
shared_data->alarm_y = -1;
|
||||
} else {
|
||||
shared_data = nullptr;
|
||||
}
|
||||
|
||||
if ( ( ! mem_ptr ) || ! shared_data->valid ) {
|
||||
|
@ -2103,7 +2105,6 @@ Monitor *Monitor::Load(MYSQL_ROW dbrow, bool load_zones, Purpose purpose) {
|
|||
} else {
|
||||
v4l_captures_per_frame = config.captures_per_frame;
|
||||
}
|
||||
Debug(1, "Got %d for v4l_captures_per_frame", v4l_captures_per_frame);
|
||||
col++;
|
||||
|
||||
std::string protocol = dbrow[col] ? dbrow[col] : ""; col++;
|
||||
|
@ -2372,10 +2373,13 @@ Monitor *Monitor::Load(MYSQL_ROW dbrow, bool load_zones, Purpose purpose) {
|
|||
0
|
||||
);
|
||||
camera->setMonitor(monitor);
|
||||
Zone **zones = 0;
|
||||
int n_zones = Zone::Load(monitor, zones);
|
||||
monitor->AddZones(n_zones, zones);
|
||||
monitor->AddPrivacyBitmask(zones);
|
||||
int n_zones = 0;
|
||||
if ( load_zones ) {
|
||||
Zone **zones = 0;
|
||||
n_zones = Zone::Load(monitor, zones);
|
||||
monitor->AddZones(n_zones, zones);
|
||||
monitor->AddPrivacyBitmask(zones);
|
||||
}
|
||||
Debug(1, "Loaded monitor %d(%s), %d zones", id, name, n_zones);
|
||||
return monitor;
|
||||
} // end Monitor *Monitor::Load(MYSQL_ROW dbrow, bool load_zones, Purpose purpose)
|
||||
|
|
Loading…
Reference in New Issue