Correct way to change BackImage
Posted: Thu May 18, 2023 9:08 am
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
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