To remove only the objects in the ROI area and remove the rest, the program crashes.

static void
process_meta (AppCtx * appCtx, NvDsBatchMeta * batch_meta)
{
// For single source always display text either with demuxer or with tiler
if (!appCtx->config.tiled_display_config.enable ||
appCtx->config.num_source_sub_bins == 1) {
appCtx->show_bbox_text = 1;
}

for (NvDsMetaList * l_frame = batch_meta->frame_meta_list; l_frame != NULL; l_frame = l_frame->next)
{
NvDsFrameMeta *frame_meta = l_frame->data;
for (NvDsMetaList * l_obj = frame_meta->obj_meta_list; l_obj != NULL; l_obj = l_obj->next)
{
NvDsObjectMeta *obj = (NvDsObjectMeta *) l_obj->data;

  if( obj->rect_params.left < 450 && ... ) l_obj = g_list_remove(l_obj, obj);   <-- Where the program crashes	
}

}
}

for (l_obj = frame_meta->obj_meta_list; l_obj != NULL; ) {

  obj_meta = (NvDsObjectMeta *) (l_obj->data);

  /* Keep the pointer to the next object node before possible removal of the object */

  l_obj = l_obj->next;

  ...

  < Some logic preceeding to ROI check>

  ...

     

  if (<Object removal condition>) {

    nvds_remove_obj_meta_from_frame (frame_meta, obj_meta);

    continue;

  }

  ...

  < Some logic after ROI check - obj_meta not valid anymore if removed >

  ...

}

Can you try it out like this ?