le_sms_Delete in multi apps crash

I have two separate apps both handling SMS depending on a prefix,
the app that handles the SMS deletes it like this
le_result_t res = decodeMsgRequest(tel, text);
if (res == LE_OK)
{
char text2[LE_SMS_TEXT_MAX_BYTES] = {0};
le_sms_GetText(msgRef, text2, sizeof(text2));
LE_ERROR(“remove SMS ‘%s’\n”, text2);
res = le_sms_DeleteFromStorage(msgRef);
if (res != LE_OK)
{
LE_ERROR(“Unable to remove SMS ‘%s’\n”, text2);
}
le_sms_Delete(msgRef);
}

but sometimes it will kill the app ?
swi-mdm9x28-wp user.emerg Legato: EMR | modemDaemon[1366]/modemDaemon T=main | le_sms.c le_sms_Delete() 2506 | This message (ref.0xe38ff0) belongs to a Rx List ! Call ‘DeleteList’ instead.
Feb 28 10:55:06 swi-mdm9x28-wp user.err Legato: =ERR= | modemDaemon[1366]/modemDaemon T=main | le_sms.c CloseSessionEventHandler() 2209 | SessionRef (0xe9bb90) has been closed

What is the correct way of handling this ?

WP7702
SWI9X06Y_02.36.06.00 63d944 jenkins 2020/12/10 19:12:28
Linux version 4.14.253
Legato: 21.05.0

does the problem exist if only one application handles the SMS?

From the code of le_sms.c here:


 if (msgPtr->inAList)
    {
        LE_KILL_CLIENT("This message (ref.%p) belongs to a Rx List ! Call 'DeleteList' instead.",
                        msgRef);
        return;
    }

You might need to check this whether to use le_sms_DeleteList()

No i haven’t seen it when there was only one app,
maybe I should only call le_sms_delete if msgPtr->inAList is not part of a list?

yes, you might need to try that first