Skip to content
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

Merged
merged 1 commit into from
Jun 29, 2015

Conversation

xhaggi
Copy link
Member

@xhaggi xhaggi commented Jun 28, 2015

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

@xhaggi xhaggi added the Type: Fix non-breaking change which fixes an issue label Jun 28, 2015
@xhaggi xhaggi added this to the Isengard 15.0-rc1 milestone Jun 28, 2015
@@ -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.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

@Jalle19
Copy link
Member

Jalle19 commented Jun 28, 2015

Sounds reasonable

@xhaggi xhaggi force-pushed the pvr-fix-empty-group-handling branch 2 times, most recently from 33b309a to 126c817 Compare June 28, 2015 09:49
@xhaggi
Copy link
Member Author

xhaggi commented Jun 28, 2015

@Jalle19 should i drop the logging?

@xhaggi
Copy link
Member Author

xhaggi commented Jun 28, 2015

jenkins build this please

@xhaggi xhaggi force-pushed the pvr-fix-empty-group-handling branch from 126c817 to 181156d Compare June 28, 2015 15:03
@xhaggi
Copy link
Member Author

xhaggi commented Jun 28, 2015

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.

@xhaggi
Copy link
Member Author

xhaggi commented Jun 28, 2015

jenkins build this please

@xhaggi
Copy link
Member Author

xhaggi commented Jun 28, 2015

@Jalle19 mind taking a quick look again

@Jalle19
Copy link
Member

Jalle19 commented Jun 28, 2015

I guess it's okay, only looked at the diff though, not the whole context.

xhaggi added a commit that referenced this pull request Jun 29, 2015
[pvr] fix: delete of empty group with an invalid id ends up in deleting the wrong group
@xhaggi xhaggi merged commit 64bb2e6 into xbmc:master Jun 29, 2015
@xhaggi xhaggi deleted the pvr-fix-empty-group-handling branch July 7, 2015 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Fix non-breaking change which fixes an issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants