Hi
I'm working with some legacy code that was created with TeeChart VCL and C++ Builder V6.
We've upgraded to C++ Builder 11.3 and TeeChart Pro V2022.36.220929...
One of our charts creates a BackImage and sometimes needs to change it and the code that achieves that does the following:
if (Chart->BackImage != NULL)
Chart->BackImage = NULL;
and then creates and assigns a new BackImage.
Most of the time this works, but sometimes it an causes access violation, always with this stack trace:
00e2d029 +00d Operations2022.exe System 19926 +1 TMonitor.Destroy
00e2d014 +014 Operations2022.exe System 19920 +9 TMonitor.Destroy
00e2c809 +029 Operations2022.exe System 18614 +23 TObject.CleanupInstance
00e2c631 +005 Operations2022.exe System 18314 +1 TObject.FreeInstance
01b94f65 +019 Operations2022.exe Madexcept _17445
00f94183 +033 Operations2022.exe Vcl.Graphics 8150 +5 TBitmap.Destroy
00e2c730 +008 Operations2022.exe System 18378 +1 TObject.Free
00f90a6a +00e Operations2022.exe Vcl.Graphics 5951 +1 TPicture.Destroy
013aea89 +021 Operations2022.exe Vcltee Tecanvas.TTeePicture.Destroy
00e2c730 +008 Operations2022.exe System 18378 +1 TObject.Free
00e58780 +008 Operations2022.exe System.SysUtils 27992 +2 FreeAndNil
013ca1e5 +021 Operations2022.exe Vcltee Teeprocs.TCustomTeePanelExtended.SetBackImage
To my mind, the line Chart->BackImage = NULL; looks suspicious but I can't find in the documentation if there is a correct way to remove an existing BackImage and then recreate it...
Any advice would be appreciated.
Andy
Correct way to change BackImage
Re: Correct way to change BackImage
Hello Andy,
I've just given it a try with the same version, just in a new application with a TChart two buttons and the code below, and it seems to work pefectly:
Unit1.h:
Unit1.cpp:
If you still find problems with it, could you please try in a new simple example?
I've just given it a try with the same version, just in a new application with a TChart two buttons and the code below, and it seems to work pefectly:
Unit1.h:
Code: Select all
#include <VCLTee.TeePNG.hpp>
#include <VCLTee.TeeConst.hpp>
Code: Select all
#pragma link "VCLTee.TeePNG"
//...
void __fastcall TForm1::FormCreate(TObject *Sender)
{
this->Caption=TeeMsg_Version;
Chart1->Walls->Hide();
Chart1->Axes->Hide();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Chart1->BackImage->LoadFromFile("E:\\tmp\\steema.png");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Chart1->BackImage=NULL;
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Correct way to change BackImage
Thanks Yeray
I still get the problem occasionally in our legacy app - I'll have to dig into the code more. It doesn't occur in simple demos, unfortunately.
My main question is - is this line Chart1->BackImage=NULL; the 'correct' way to clear the background image? I can't find anything in the documentation...
Andy
I still get the problem occasionally in our legacy app - I'll have to dig into the code more. It doesn't occur in simple demos, unfortunately.
My main question is - is this line Chart1->BackImage=NULL; the 'correct' way to clear the background image? I can't find anything in the documentation...
Andy
Re: Correct way to change BackImage
Yeray
After a lot of debugging and logging, it seems memory 'near' the object containing the TeeChart had been corrupted, occasionally causing the issue...
Andy
After a lot of debugging and logging, it seems memory 'near' the object containing the TeeChart had been corrupted, occasionally causing the issue...
Andy
Re: Correct way to change BackImage
Hello Andy,
Yes, that's the correct way.
Yes, that's the correct way.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |