Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we checking length is zero?
commandsList[menuID]
needs to be deleted when we respond success to DeleteSubMenu.Currently if I create a submenu, add a command to it, and delete the submenu I get success... but other issues are created. Now I cannot create a sub menu with the same ID as the first because "it already exists".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iCollin we should keep
commandsList[menuID]
element in the map if it still contains any child node (which can be Command or another SubMenu). This is necessary because SDL is responsible for a recursive deleting of the tree hierarchy of these nodes and in case if HMI is not able to findmenuID
in the map then it will respond withINVALID_ID
or does not respond at all (ex see steps from the linked issue).I mean that
commandList[menuID]
will be deleted by the next request from SDL, but before that element should stay in the map.Meanwhile, could you please describe the issue with the submenu you faced with? Is it reproducible on develop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that we tell if a submenu exists by checking if
commandList[menuID]
exists, so we cannot both keep it and tell Core it is deleted. Here is where the SDL HMI sends INVALID_ID.Interesting conundrum. The SDL HMI cannot truly delete the submenu until all its children are deleted, and Core only deletes the children once the SDL HMI has replied SUCCESS to the DeleteSubmenu request.
This is part of the pain of tracking commands in two places, I don't know if there is an easy solution for this. The best solution I can think of is to have Core trust the HMI to delete the submenu's children, and not send RPCs for the child menus and commands. Am I understanding the issue correctly? Can you think of a better solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iCollin right, it's possible to fix from SDL side and remove this logic from there (which solves that problem), but I believe it violates the requirement we have for SDL:
So most likely we should play with an HMI-side fix to solve the regression caused by that fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting there is no mention of the
HMI -> SDL: UI DeleteSubMenu Response
, maybe we can modify SDL Core to delete children of a menu before it deletes the parent?Another solution could be the HMI tracking dead menuItems in another list, but I don't like that idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iCollin I think we can update SDL behavior as now it deletes parent node before its child nodes which is confusing HMI. In case if SDL will send requests in the correct order, this fix won't be required anymore.
I submitted an issue smartdevicelink/sdl_core#3747 to OpenSDL.
SDL fix will be prepared and linked to a new issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iCollin fix from SDL side is ready - smartdevicelink/sdl_core#3748