Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 2032

Summary: Segmentation Fault (11) when calling AddXY in Android
Product: FireMonkey TeeChart Reporter: yeray alonso <yeray>
Component: SeriesAssignee: Steema Issue Manager <issuemanager>
Status: CONFIRMED ---    
Severity: enhancement    
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description yeray alonso 2018-05-02 08:10:02 EDT
AddXY function works fine in Windows, both for Delphi and C++.
It also works fine in Android for Delphi, but gives a "Segmentation Fault (11)" in Android for C++:

	for ( int i = 0; i < 10; i++)
	{
		Series1->AddXY(i, i);
	}

A workaround is to use AddArray instead. Ie:

	// In the .h
	double xarray[10];
	double yarray[10];

	// In the .cpp
	for ( int i = 0; i < 10; i++)
	{
		xarray[i] = (double)i;
		yarray[i] = (double)i;
	}

	Series1->AddArray(xarray,9,yarray,9);
	Series1->Repaint();
Comment 1 yeray alonso 2018-05-03 04:59:20 EDT
Note there are some other calls also giving a "Segmentation Fault (11)" error in C++Builder for Android. Not sure if they are related to the AddXY error.

Series1->YValues->Items[Series1->Count()-1]
Series1->YValues->Last()
Comment 2 yeray alonso 2018-05-03 05:00:52 EDT
Regarding the workaround, you could use AddArray function to simulate AddXY function using an array of one single element. Ie:

void __fastcall TForm1::AddXY(TChartSeries *Series, double x, double y)
{
    xarray[0] = x;
    yarray[0] = y;
    Series->AddArray(xarray,0,yarray,0);
}

Then, you can call it as in this button:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    for ( int i = 0; i < 10; i++)
    {
        AddXY(Series1, Series1->Count(), Series1->Count());
    }
    Series1->Repaint();
}
Comment 3 yeray alonso 2019-03-25 10:41:18 EDT
Adding the unit FMXTee.Engine.pas to the project makes the IDE to recompile it and the problem disappears.

These are good news for the source code customers, but it impedes us to debug and find the cause of the problem for those who don't have the sources.