I implemented the code to remove only the objects in the ROI area and remove the objects outside the ROI area, but the program crashes.

I implemented the code to remove only the objects in the ROI area and remove the objects outside the ROI area, but the program crashes.

The following code is implemented in process_meta () function of deepstream-app.c and the program crashes.
Thank you for your help.

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 && … )
{
g_list_remove(l_obj, obj); ← Where the program crashes

                         OR

               l_obj = g_list_remove(l_obj, obj);  <-- This will crash likewise.
        }

=======================================================
}
}
}

+1 I’m also interested in this

This has been answered here - [url]https://devtalk.nvidia.com/default/topic/1064426/deepstream-sdk/to-remove-only-the-objects-in-the-roi-area-and-remove-the-rest-the-program-crashes-/post/5391301/#5391301[/url]

Can you please take a look ?