-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pvr] fix: delete of empty group with an invalid id ends up in deleting the wrong group #7356
Conversation
@@ -536,6 +536,11 @@ bool CPVRChannelGroups::DeleteGroup(const CPVRChannelGroup &group) | |||
CLog::Log(LOGERROR, "PVR - %s - cannot delete internal group '%s'", __FUNCTION__, group.GroupName().c_str()); | |||
return false; | |||
} | |||
if (group.GroupID() <= 0) | |||
{ | |||
CLog::Log(LOGDEBUG, "PVR - %s - cannot delete group '%s' invalid id '%i'", __FUNCTION__, group.GroupName().c_str(), group.GroupID()); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Sounds reasonable |
33b309a
to
126c817
Compare
@Jalle19 should i drop the logging? |
jenkins build this please |
…ng the wrong group
126c817
to
181156d
Compare
Instead of return immediately if group don't hold a valid id, I've changed the condition within the iteration. Now it checks for the same instance or if group id is valid (greater 0) for id equality. This will delete the group from the list and if a valid id exists from the database. |
jenkins build this please |
@Jalle19 mind taking a quick look again |
I guess it's okay, only looked at the diff though, not the whole context. |
[pvr] fix: delete of empty group with an invalid id ends up in deleting the wrong group
If your backend holds an empty group and you import the channel groups for the first time (after a clear of the TV database or with a new setup) each of the groups won't hold a valid id because they are new to our database. As we delete empty groups after loading the related channels and these groups don't hold a valid id (-1) this will result in deleting the wrong group e.g. the first group with id -1 which is the internal "All channels" group. After that everything is screwed up.
This will add a check for a valid group id (> 0) to
CPVRChannelGroups::DeleteGroup
to prevent deleting the wrong group.@Jalle19 @opdenkamp mind taking a look