ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  surface projection case crashes in certain condition
Posted by David on Jun-22-2022 18:47
Hello,

I found a weird problem when making surface projection chart for a combination of certain data set and operations in ChartDirector 7.

As an example to illustrate the problem, I modified the input data of mfcdemo's surfaceprojection method:

double dataX[] = {0.001, 0.003, 0.005, 0.007, 0.009, 0.011, 0.013};
    const int dataX_size = (int)(sizeof(dataX)/sizeof(*dataX));
    double dataY[] = {-5, 0, 5, 10, 15};
    const int dataY_size = (int)(sizeof(dataY)/sizeof(*dataY));

// Use random numbers for the z values on the XY grid
    RanSeries* r = new RanSeries(11);
    DoubleArray dataZ = r->get2DSeries(dataX_size, dataY_size, 0.1, 1.9);

Then after launching the program, if I first clicked another surface chart such as "surface perspective", then opened the surface projection chart, the program crashed in ChartViewer.cpp with an access violation.

  Re: surface projection case crashes in certain condition
Posted by Peter Kwan on Jun-23-2022 00:05
Hi David,

Unluckily, I am unable to reproduce this problem.

Can you try the followings?

(1) Download a new copy of ChartDirector for C++ from our web site. Extract it to any folder.

(2) Open the mfcdemo Visual Studio solution.

(3) Go to the mfccharts.cpp file, and find the "surfaceprojection". Replace the original dataX, dataY and RanSeries code in surfaceprojection with the code in your last message.

(4) Press the "Run" button.

Please let me know if you can crash the program and the exact step to do so. You may modify the code until the program can crash. If it crashes in ChartViewer.cpp, Visual Studio should be able to determine the "Stack Trace". Please let me know which line in ChartViewer.cpp crashes the program. It is useful if you copy and paste the "Stack Trace" in your message.

Best Regards
Peter Kwan

  Re: surface projection case crashes in certain condition
Posted by David on Jun-23-2022 17:35
Hi Peter,

Thanks. To clarify, after the step 4, if you open "surface projection" case directly, the program does not crash. However, if you first open a "surface perspective" for example, then open the "surface projection", the program crashes.

The error line is at { return CBaseChart_makeChart2(ptr, format, data, len); }
in chartdir.h

Exception thrown at 0x5B8EFD7E (chartdir70.dll) in mfcdemo.exe: 0xC0000005: Access violation reading location 0x404749F0.


My stack trace is like this:

chartdir70.dll!5b8efd7e()
[Frames below may be incorrect and/or missing, no symbols loaded for chartdir70.dll]
[External Code]
mfcdemo.exe!BaseChart::makeChart(int format, const char * * data, int * len) Line 1237
at \machomedownloadschartdirector 7includechartdir.h(1237)
mfcdemo.exe!BaseChart::makeChart(int format) Line 1239
at \machomedownloadschartdirector 7includechartdir.h(1239)
mfcdemo.exe!CStaticHelper::renderChart(BaseChart * c) Line 1742
at \machomedownloadschartdirector 7mfcdemomfcdemochartviewer.cpp(1742)
mfcdemo.exe!CStaticHelper::displayChart(BaseChart * c) Line 1756
at \machomedownloadschartdirector 7mfcdemomfcdemochartviewer.cpp(1756)
mfcdemo.exe!CChartViewer::commitUpdateChart() Line 1220
at \machomedownloadschartdirector 7mfcdemomfcdemochartviewer.cpp(1220)
mfcdemo.exe!CChartViewer::updateDisplay() Line 1198
at \machomedownloadschartdirector 7mfcdemomfcdemochartviewer.cpp(1198)
mfcdemo.exe!CChartViewer::setChart(BaseChart * c) Line 837
at \machomedownloadschartdirector 7mfcdemomfcdemochartviewer.cpp(837)
mfcdemo.exe!surfaceprojection(CChartViewer * viewer, int __formal) Line 10740
at \machomedownloadschartdirector 7mfcdemomfcdemomfccharts.cpp(10740)
mfcdemo.exe!CmfcdemoDlg::OnSelChangedChartTree(tagNMHDR * pNMHDR, long * pResult) Line 211
at \machomedownloadschartdirector 7mfcdemomfcdemomfcdemodlg.cpp(211)
[External Code]
mfcdemo.exe!CmfcdemoApp::InitInstance() Line 44
at \machomedownloadschartdirector 7mfcdemomfcdemomfcdemo.cpp(44)
[External Code]
mfcdemo.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 26
at d:agent_work3ssrcvctoolsvc7libsshipatlmfcsrcmfcappmodul.cpp(26)
[External Code]

  Re: surface projection case crashes in certain condition
Posted by Peter Kwan on Jun-24-2022 02:48
Attachments:
Hi David,

Yes, I am aware I need to open the "surface perspective" first, then open the "surface projection", but I am unable to cause it to crash.

I manually set a breakpoint and I found that the line numbers in my stack trace is slightly different from your stack trace. For your testing, are you using a fresh copy of ChartDirector downloaded from our web site, or is it an existing copy on your computer? The last time we update the windows C++ distribution on our web site is 2022-02-28.

You can download my exact test project below. It is the same as the ChartDirector downloaded from our web site, except the data for the Surface Projection sample code is modified to use your data. You can just download it, open the mfc Visual Studio solution, and press "Run" to try it.

https://www.advsofteng.com/support/chartdir_cpp_test_20220624.zip

I have also attached the screenshot of the chart I got after opening "surface perspective" and then "surface projection". This is to make sure we use the same random numbers as data. (The ChartDirector random number generator is designed to generate the same random numbers given the same seed to facilitate trouble-shooting.)

The Chart::DataColor issue mentioned in your other message has already been fixed. If any issue is found in the SurfaceChart, I will include them in the fix before releasing it.

Best Regards
Peter Kwan
mfcdemo_20220624011555.png

  Re: surface projection case crashes in certain condition
Posted by David on Jun-24-2022 09:03
Hi Peter,

Thanks! I did a comparison again and found the actual line that caused the crash. Steps to reproduce:

1. In the code you sent me, comment out "c->setInterpolation(80, 80);"
2. Run the program, click "surfaceperspective", then click "surfaceprojection"
3. the program crashes

Actually opening any other surface charts before opening the surfaceprojection chart crashed the program.

  Re: surface projection case crashes in certain condition
Posted by Peter Kwan on Jun-25-2022 01:11
Hi David,

Thanks for your information. We can easily reproduce the problem and fix it. Below please find the updated Windows DLL that should fix the surface chart projection issue and also the Chart::DataColor issue.

https://www.advsofteng.com/support/chartdir_cpp_win_703.zip

Regards
Peter Kwan

  Re: surface projection case crashes in certain condition
Posted by David on Jun-26-2022 08:03
Great! Thanks.