From 2135e58c41a9edf8cbf7a5533cccf3093d417be5 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Sun, 6 Nov 2011 14:13:28 +0200 Subject: [PATCH] Fixed zma crashes caused by flaky signal and few bugs in mocord mode. --- src/zm_monitor.cpp | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/zm_monitor.cpp b/src/zm_monitor.cpp index 5bbff9dd4..ec89b22bc 100644 --- a/src/zm_monitor.cpp +++ b/src/zm_monitor.cpp @@ -1234,7 +1234,6 @@ bool Monitor::Analyse() { Info( "%s: %03d - Closing event %d, signal loss", name, image_count, event->Id() ); closeEvent(); - shared_data->state = state = IDLE; last_section_mod = 0; } if ( !event ) @@ -1246,6 +1245,7 @@ bool Monitor::Analyse() Event::StringSet noteSet; noteSet.insert( signalText ); noteSetMap[SIGNAL_CAUSE] = noteSet; + shared_data->state = state = IDLE; shared_data->active = signal; ref_image = *snap_image; } @@ -1311,8 +1311,11 @@ bool Monitor::Analyse() { if ( state == IDLE || state == TAPE || event_close_mode == CLOSE_TIME ) { - if ( state == IDLE || state == TAPE ) + if ( state == TAPE ) + { + shared_data->state = state = IDLE; Info( "%s: %03d - Closing event %d, section end", name, image_count, event->Id() ) + } else Info( "%s: %03d - Closing event %d, section end forced ", name, image_count, event->Id() ); closeEvent(); @@ -1326,7 +1329,6 @@ bool Monitor::Analyse() } if ( !event ) { - shared_data->state = state = TAPE; // Create event event = new Event( this, *timestamp, "Continuous", noteSetMap ); @@ -1334,6 +1336,12 @@ bool Monitor::Analyse() Info( "%s: %03d - Opening new event %d, section start", name, image_count, event->Id() ); + /* To prevent cancelling out the prealarm or alarm state caused from signal reacquired or from a linked monitor */ + if ( state == IDLE ) + { + shared_data->state = state = TAPE; + } + //if ( config.overlap_timed_events ) if ( false ) { @@ -1535,23 +1543,6 @@ bool Monitor::Analyse() } } } - if ( function == RECORD || function == MOCORD ) - { - if ( state == IDLE || state == TAPE ) - { - int section_mod = timestamp->tv_sec%section_length; - if ( section_mod < last_section_mod ) - { - Info( "%s: %03d - Closing event %d, section end2", name, image_count, event->Id() ); - closeEvent(); - last_section_mod = 0; - } - else - { - last_section_mod = section_mod; - } - } - } } } else