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

Infinite loop when setting data on ChartDataEntry object #86

Closed
justinswart opened this issue May 14, 2015 · 4 comments
Closed

Infinite loop when setting data on ChartDataEntry object #86

justinswart opened this issue May 14, 2015 · 4 comments

Comments

@justinswart
Copy link

I'm setting additional data on the ChartEntryObject to pass it to the Marker view:

for accountBalance in accountBalances
{
    var entry = ChartDataEntry(value: accountBalance.amount.floatValue, xIndex: count++)
    entry.data = dateFormatter.stringFromDate(accountBalance.date)

    yVals.append(entry)
}

This causes EXC_BAD_ACCESS infinite loop in ChartDataEntry.swift:
screen shot 2015-05-14 at 3 34 13 pm

The problem is fixed by changing line 64 of ChartDataEntry.swift from:

if (object!.data !== data && !object!.isEqual(self))

to

if (object!.data !== data)

Is it safe to do so?

@danielgindi
Copy link
Collaborator

Actually it isn't, the correct fix would be to changed line 54 to be === instead of ==

Thanks for the catch :-)

danielgindi added a commit that referenced this issue May 14, 2015
@justinswart
Copy link
Author

Hi, thanks for the quick reply. I changed that line as you suggested but it's now causing EXC_BAD_ACCESS on the line that I thought may be the problem:

screen shot 2015-05-14 at 3 48 01 pm

Making this change does appear to fix it:

if (object!.data !== data)

I'm new to Swift so I'm just not sure of the full implications of this. Is !object!.isEqual(self) not somehow causing an infinite isEqual() loop on itself?

@danielgindi
Copy link
Collaborator

It was just another thing I missed. It should have been isEqual(data)... A commit coming right up.

danielgindi added a commit that referenced this issue May 14, 2015
@justinswart
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants