TeeChart crash with Japanese date/number/currency settings
TeeChart crash with Japanese date/number/currency settings
Change Windows' Date & time, number and currency settings to "Japanese (Japan)":
Create a program which uses GDIPlus (uses startup and shutdown). Create two charts with GDIPlus rendering disabled. When trying to disable GDIPlus rendering for the second chart a call to GDIPlusShutdown throws an exception.
OS: Windows 10
TeeChart 2019 ActiveX
A simple C++ test application included in .zip file.
Edit: If setting is f.ex. English application works as intended.
Create a program which uses GDIPlus (uses startup and shutdown). Create two charts with GDIPlus rendering disabled. When trying to disable GDIPlus rendering for the second chart a call to GDIPlusShutdown throws an exception.
OS: Windows 10
TeeChart 2019 ActiveX
A simple C++ test application included in .zip file.
Edit: If setting is f.ex. English application works as intended.
- Attachments
-
- TeeChart Crash.zip
- (113.84 KiB) Downloaded 1582 times
Re: TeeChart crash with Japanese date/number/currency settings
Hello,
We are checking this and will get back to this thread. We can reproduce the error and are testing a code fix to TeeChart.
Regards,
Marc Meumann
We are checking this and will get back to this thread. We can reproduce the error and are testing a code fix to TeeChart.
Regards,
Marc Meumann
Steema Support
Re: TeeChart crash with Japanese date/number/currency settings
Hello Tero,
We have emailed you a link to download a test version. Please inform us with feedback so we can be clear how to proceed.
With thanks.
Regards,
Marc
We have emailed you a link to download a test version. Please inform us with feedback so we can be clear how to proceed.
With thanks.
Regards,
Marc
Steema Support
Re: TeeChart crash with Japanese date/number/currency settings
I tested this today because we have to consider switching back to GDI rendering because of area series drawing bugs with GDI+ rendering.
Unfortunately this did not fix the crash.
Unfortunately this did not fix the crash.
Re: TeeChart crash with Japanese date/number/currency settings
Hi,
I'm unable to reproduce the problem with the latest version of TeeChart AX and the test project you sent in. Can you confirm please if the problem as you see it shows itself in the test project?
With thanks.
Regards,
Marc
I'm unable to reproduce the problem with the latest version of TeeChart AX and the test project you sent in. Can you confirm please if the problem as you see it shows itself in the test project?
With thanks.
Regards,
Marc
Steema Support
Re: TeeChart crash with Japanese date/number/currency settings
I get the crash using latest TeeChart version (2019.00.7.23) using the test application I included earlier. Compiled both release and debug versions with VS2019 version 16.3.5. Both versions throw an exception from ntdll.dll when run as "Local Windows Debugger" from VS2019 IDE:
Japanese formatting settings selected. Windows version is Windows 10 Enterprise 1709.
Code: Select all
void CTeeGDIPlus::GDIPlusShutdown()
{
this called =>: InvokeHelper(0xcc, DISPATCH_METHOD, VT_EMPTY, NULL, NULL);
}
try
{
m_pChart2->GetAspect().GetGDIPlus().SetActive(false);
from here =>: m_pChart2->GetAspect().GetGDIPlus().GDIPlusShutdown();
}
Re: TeeChart crash with Japanese date/number/currency settings
A note on this to check.
GDIPlusShutdown should only be called once as it unloads the library (would also affect GDIPlus for the entire .exe). It shouldn't be unloaded if a call to GDIPlus methods is made after the call.
Another question. Your comment:
With thanks.
Regards,
Marc
GDIPlusShutdown should only be called once as it unloads the library (would also affect GDIPlus for the entire .exe). It shouldn't be unloaded if a call to GDIPlus methods is made after the call.
Another question. Your comment:
We can look at this. Is this something that's been reported elsewhere?consider switching back to GDI rendering because of area series drawing bugs with GDI+ rendering
With thanks.
Regards,
Marc
Steema Support
Re: TeeChart crash with Japanese date/number/currency settings
Our app uses GDI+ rendering elsewhere even before TeeChart2019.ocx is loaded or any TeeChart objects have been created so we call GDIPlusStartup and GDIPlusShutdown. We call GDIPlusStartup in InitInstance method and GDIPlusShutdown in ExitInstance.
From Microsoft Dev Center documentation:
APP InitInstance: Startup
DLL : Startup
DLL: Shutdown
APP ExitInstance: Shutdown
Is OK.
APP InitInstace: Startup
DLL: Startup
APP ExitInstance: Shutdown
DLL: Shutdown
Is APP process is never terminated.
Problem is we cannot control when or how or if TeeChart2019.ocx calls GDIPlusStartup or GDIPlusShutdown and need TeeChart object to do so even if both of those were exported.
Best practise would be if TeeChart2019.ocx never calls GDIPlusStartup or GDIPlusShutdown but only our app does (first solution in the list provided by Microsoft). If you can suggest how we should use TeeChart from an app which uses GDI+ also elsewhere with any number (0 - unlimited) TeeChart objects created at any time please do so.
There is a bugtracker for the area drawing problem so do not worry about that.
BR,
Tero M.
From Microsoft Dev Center documentation:
Our understanding is that you can call those functions as many times as you wish if calls do not "cross boundaries" (essentially solutions 2 & 3 in the list provided by Microsoft):Do not call GdiplusStartup or GdiplusShutdown in DllMain or in any function that is called by DllMain. If you want to create a DLL that uses GDI+, you should use one of the following techniques to initialize GDI+:
- Require your clients to call GdiplusStartup before they call the functions in your DLL and to call GdiplusShutdown when they have finished using your DLL.
- Export your own startup function that calls GdiplusStartup and your own shutdown function that calls GdiplusShutdown. Require your clients to call your startup function before they call other functions in your DLL and to call your shutdown function when they have finished using your DLL.
- Call GdiplusStartup and GdiplusShutdown in each of your functions that make GDI+ calls.
APP InitInstance: Startup
DLL : Startup
DLL: Shutdown
APP ExitInstance: Shutdown
Is OK.
APP InitInstace: Startup
DLL: Startup
APP ExitInstance: Shutdown
DLL: Shutdown
Is APP process is never terminated.
Problem is we cannot control when or how or if TeeChart2019.ocx calls GDIPlusStartup or GDIPlusShutdown and need TeeChart object to do so even if both of those were exported.
Best practise would be if TeeChart2019.ocx never calls GDIPlusStartup or GDIPlusShutdown but only our app does (first solution in the list provided by Microsoft). If you can suggest how we should use TeeChart from an app which uses GDI+ also elsewhere with any number (0 - unlimited) TeeChart objects created at any time please do so.
There is a bugtracker for the area drawing problem so do not worry about that.
BR,
Tero M.
Re: TeeChart crash with Japanese date/number/currency settings
Hello Tero,
Yes, the not crossing-boundaries should be valid. Our understanding of best practice when researching use of GDIPlus in an app that hosts a dll is to use nesting. ie. with the test code it might look something like this:
That does work ok in tests here. The other approach, the original test code, also works when debugging but fails in a straight run from the exe so it's making the tracking down of the cause difficult. Though we haven't yet confirmed why that might be it seems it may be related to the gdiplus token (and reuse of) that is being generated and freeing with shutdown. When the shutdown is nested that doesn't occur.
Picking up the original test after being parked some months. I hadn't noticed for my earlier feedback, that we'd left only the second gdiplus shutdown active; that works fine [in the test app] too. If possible to nest that would be the recommendation but you'd need to test it in the context of your main app.
We'll check further to see if we can improve our feedback on the issue.
Regards,
Marc
Yes, the not crossing-boundaries should be valid. Our understanding of best practice when researching use of GDIPlus in an app that hosts a dll is to use nesting. ie. with the test code it might look something like this:
Code: Select all
CRect chart1Rect(rect);
chart1Rect.DeflateRect(0, 0, rect.Width() / 2, 0);
CRect chart2Rect(chart1Rect);
chart2Rect.MoveToXY(rect.Width() / 2, 0);
m_pChart1 = std::unique_ptr<CTChart>(new CTChart());
if (!m_pChart1->Create("Chart 1", WS_CHILD|WS_VISIBLE, chart1Rect, this, ID_CHART1))
return -1;
try
{
m_pChart2 = std::unique_ptr<CTChart>(new CTChart());
if (!m_pChart2->Create("Chart 2", WS_CHILD | WS_VISIBLE, chart2Rect, this, ID_CHART2))
return -1;
try
{
m_pChart2->GetAspect().GetGDIPlus().SetActive(false);
m_pChart2->GetAspect().GetGDIPlus().GDIPlusShutdown();
}
catch (CException* pE)
{
AfxMessageBox("Caught an exception when calling TeeChart GDIPlusShutdown() for chart 2.", MB_ICONERROR | MB_OK);
return -1;
}
m_pChart1->GetAspect().GetGDIPlus().SetActive(false);
m_pChart1->GetAspect().GetGDIPlus().GDIPlusShutdown();
}
catch (CException* pE)
{
AfxMessageBox("Caught an exception when calling TeeChart GDIPlusShutdown() for chart 1.", MB_ICONERROR|MB_OK);
return -1;
}
Picking up the original test after being parked some months. I hadn't noticed for my earlier feedback, that we'd left only the second gdiplus shutdown active; that works fine [in the test app] too. If possible to nest that would be the recommendation but you'd need to test it in the context of your main app.
We'll check further to see if we can improve our feedback on the issue.
Regards,
Marc
Steema Support
Re: TeeChart crash with Japanese date/number/currency settings
The creation and destruction of charts is controlled by the user i.e. user creates data views and closes them at will so it is not possible to implement a system like in the example above (which is very simplistic example just to recreate the exception).
BR,
Tero M.
BR,
Tero M.