ChartsOrg / ChartsOrg/Charts

drawAngles[j] crash in PieChartRenderer using custom PieChartView in Xcode 11+

Open
#4,231 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I am using a custom `PieChartView`, overriding the functions I need to create a custom pie chart. I am using the latest version of Charts from master.

Everything was working fine in Xcode 10.3, but when upgrading to **Xcode 11**, a crash occurred with `drawAngles[j]` in `PieChartRenderer`, because `drawAngles` has a size of 0:
![Untitled](https://user-images.githubusercontent.com/8109158/69520816-6ebe1380-0f12-11ea-805e-9476d57a6333.png)

The cause for this is due to `PieRadarChartViewBase::notifyDataSetChanged()`, which calls `calcMinMax()`, which as a result calls `PieChartView::calcMinMax()` in **Xcode 11**:
![Untitled1-2](https://user-images.githubusercontent.com/8109158/69520936-bb095380-0f12-11ea-9950-4620282f199d.png)

However in **Xcode 10.3**, `PieRadarChartViewBase::notifyDataSetChanged()` calls `calcMinMax()`, which correctly calls my custom overridden `CustomPieChartView::calcMinMax()`, resulting in the correct size for `drawAngles`, leading to no crash when `drawAngles` is accessed in `PieChartRenderer`:
![Untitled2-2](https://user-images.githubusercontent.com/8109158/69520839-7a113f00-0f12-11ea-9a1c-bd68939d0f37.png)

This cannot be reproduce in the demo because there's no custom `PieChartView` example.

Is anyone using a custom `PieChartView` know what in Xcode 11 is causing this issue and how to resolve?

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.