Commit 512c4ecc authored by Claes Sjofors's avatar Claes Sjofors

Xtt satellite alarm and event list, bugfix when event is rmoved

parent 59e12976
...@@ -1177,10 +1177,12 @@ void EvList::event_ack( mh_sAck *msg) ...@@ -1177,10 +1177,12 @@ void EvList::event_ack( mh_sAck *msg)
item->update_text(1); item->update_text(1);
} }
else { else {
brow_tObject item_tree_node = item->tree_node;
brow_DeleteNode( browbase->ctx, item->node); brow_DeleteNode( browbase->ctx, item->node);
if ( browtree) { if ( browtree) {
if ( item->tree_node) if ( item_tree_node)
brow_DeleteNode( browtree->ctx, item->tree_node); brow_DeleteNode( browtree->ctx, item_tree_node);
view_configure(); view_configure();
} }
size--; size--;
...@@ -1196,10 +1198,12 @@ void EvList::event_ack( mh_sAck *msg) ...@@ -1196,10 +1198,12 @@ void EvList::event_ack( mh_sAck *msg)
item->update_text(1); item->update_text(1);
} }
else { else {
brow_tObject item_tree_node = item->tree_node;
brow_DeleteNode( browbase->ctx, item->node); brow_DeleteNode( browbase->ctx, item->node);
if ( browtree) { if ( browtree) {
if ( item->tree_node) if ( item_tree_node)
brow_DeleteNode( browtree->ctx, item->tree_node); brow_DeleteNode( browtree->ctx, item_tree_node);
view_configure(); view_configure();
} }
size--; size--;
...@@ -1263,10 +1267,12 @@ void EvList::event_return( mh_sReturn *msg) ...@@ -1263,10 +1267,12 @@ void EvList::event_return( mh_sReturn *msg)
item->update_text(1); item->update_text(1);
} }
else { else {
brow_tObject item_tree_node = item->tree_node;
brow_DeleteNode( browbase->ctx, item->node); brow_DeleteNode( browbase->ctx, item->node);
if ( browtree) { if ( browtree) {
if ( item->tree_node) if ( item_tree_node)
brow_DeleteNode( browtree->ctx, item->tree_node); brow_DeleteNode( browtree->ctx, item_tree_node);
view_configure(); view_configure();
} }
size--; size--;
...@@ -1279,14 +1285,19 @@ int EvList::event_delete( mh_sEventId *id) ...@@ -1279,14 +1285,19 @@ int EvList::event_delete( mh_sEventId *id)
if ( type == ev_eType_AlarmList) { if ( type == ev_eType_AlarmList) {
// Alarmlist // Alarmlist
ItemAlarm *item; ItemAlarm *item;
brow_tObject item_tree_node;
if ( !id_to_item( id, (void **)&item)) if ( !id_to_item( id, (void **)&item))
return 0; return 0;
item_tree_node = item->tree_node;
brow_DeleteNode( browbase->ctx, item->node); brow_DeleteNode( browbase->ctx, item->node);
// Note, item is deleted now
if ( browtree) { if ( browtree) {
if ( item->tree_node) if ( item_tree_node)
brow_DeleteNode( browtree->ctx, item->tree_node); brow_DeleteNode( browtree->ctx, item_tree_node);
view_configure(); view_configure();
} }
size--; size--;
...@@ -1320,10 +1331,11 @@ void EvList::event_clear_alarmlist( pwr_tNodeIndex nix) ...@@ -1320,10 +1331,11 @@ void EvList::event_clear_alarmlist( pwr_tNodeIndex nix)
switch( object_item->type) { switch( object_item->type) {
case evlist_eItemType_Alarm: case evlist_eItemType_Alarm:
if ( object_item->eventid.Nix == nix) { if ( object_item->eventid.Nix == nix) {
brow_tObject item_tree_node = object_item->tree_node;
brow_DeleteNode( browbase->ctx, object_item->node); brow_DeleteNode( browbase->ctx, object_item->node);
if ( browtree) { if ( browtree) {
if ( object_item->tree_node) if ( item_tree_node)
brow_DeleteNode( browtree->ctx, object_item->tree_node); brow_DeleteNode( browtree->ctx, item_tree_node);
view_configure(); view_configure();
} }
} }
...@@ -1926,14 +1938,18 @@ ItemAlarm::ItemAlarm( EvList *item_evlist, const char *item_name, pwr_tTime item ...@@ -1926,14 +1938,18 @@ ItemAlarm::ItemAlarm( EvList *item_evlist, const char *item_name, pwr_tTime item
brow_GetUserData( last_node, (void **)&item); brow_GetUserData( last_node, (void **)&item);
int item_type = item->type;
brow_tObject item_tree_node = item->tree_node;
brow_DeleteNode( evlist->browbase->ctx, last_node); brow_DeleteNode( evlist->browbase->ctx, last_node);
if ( item->type == evlist_eItemType_Alarm && evlist->browtree) {
if ( item->tree_node)
brow_DeleteNode( evlist->browtree->ctx, item->tree_node);
evlist->view_configure();
}
// Note! This ItemAlarm might be deleted by now if node == last_node // Note! This ItemAlarm might be deleted by now if node == last_node
if ( item_type == evlist_eItemType_Alarm && item_evlist->browtree) {
if ( item_tree_node)
brow_DeleteNode( item_evlist->browtree->ctx, item_tree_node);
item_evlist->view_configure();
}
item_evlist->size--; item_evlist->size--;
} }
} }
...@@ -2825,6 +2841,7 @@ int EvList::oid_to_item( pwr_tOid oid, void **item) ...@@ -2825,6 +2841,7 @@ int EvList::oid_to_item( pwr_tOid oid, void **item)
void EvList::ack( mh_sEventId *id) void EvList::ack( mh_sEventId *id)
{ {
ItemAlarm *item; ItemAlarm *item;
brow_tObject item_tree_node;
if ( !id_to_item( id, (void **)&item)) if ( !id_to_item( id, (void **)&item))
return; return;
...@@ -2838,10 +2855,14 @@ void EvList::ack( mh_sEventId *id) ...@@ -2838,10 +2855,14 @@ void EvList::ack( mh_sEventId *id)
else if ( type == ev_eType_AlarmList) else if ( type == ev_eType_AlarmList)
{ {
// Detete the item from the alarm list // Detete the item from the alarm list
item_tree_node = item->tree_node;
brow_DeleteNode( browbase->ctx, item->node); brow_DeleteNode( browbase->ctx, item->node);
// Note! item is deleted now
if ( browtree) { if ( browtree) {
if ( item->tree_node) if ( item_tree_node)
brow_DeleteNode( browtree->ctx, item->tree_node); brow_DeleteNode( browtree->ctx, item_tree_node);
view_configure(); view_configure();
} }
size--; size--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment