Application crashes on New operation in MFC MDI application

Hi,
I'm using Open cascade 6.5 in my project which is MFC MDI application.
I'm just doing new operation multiple times and the application crashes exactly after 19th new operation but it may crash after some other count like 50th new operation in some other machine.
I have tested "ImportExport" MFC sample in Open Cascade 6.5. Same problem is happening with this sample also.
By printing messages in Open cascade code I observed that it is crashing in "wglMakeCurrent" function call of "TxglWinset" function in "Opengl_txgl.c" file.

Please help to resolve this issue if anybody knows the reason of this problem.

Thanks,
Gaurav

Forum supervisor's picture

Dear Gaurav,
To reproduce the posted problem we need additional information:
1. Testing scenario
2. Testing data
3. Environment information:
- Platform (Windows 7, …), Compiler version;
- Mode (32/ 64 bit)
Regards

gauravbanda's picture

Hi,

You can use "ImportExport" sample MFC application to reproduce this defect. Just keep clicking on new button in toolbar or new menu item until your application crashes.
There is no test data required. No drawing or anything is added to the project.
I have Windows XP installed and I'm building my application in Visual Studio 2005.
This problem is coming on both 32 bit and 64 bit machines.

Thanks & Regards,
Gaurav

Pawel's picture

Hello,

interesting... on my machine the ImportExport sample crashes when I try to create the 100th document.

I've just tested another application creating OCC documents and it also crashes while opening the 100th document.

I'm on XP 32bit with VS2008 / OCC 6.5.1.

Pawel

Forum supervisor's picture

Gaurav,
In fact you met a limitation of the current implementation (#define StructureManager_MAX 100) of OCCT.
Try to run Sample in debug mode and you will get a message like:
"...Graphic3d_InitializationError: Too many ViewManagers are defined".
See also method Limit() from Graphic3d_StructureManager.cdl.
You can consider it as a documentation bug.
The corresponding issue with ID = 22832 has been registered.
Later you may check if the issue is resolved by checking references to the specified ID in OCCT Release Notes. The analysis of the issue will take some time depending on our technical capability and availability of resources.
If the problem is critical for you, you may contact us via the Contact Form http://www.opencascade.org/about/contacts/.
Regards

Regards
Sergey

gauravbanda's picture

Hi,

I'm updating my findings on same issue with Open Cascade 6.5.2.
I have tried "ImportExport" sample MFC application of Open Cascade 6.5.2 on 2 different machines.
On 1st machine I'm able to open 99 views successfully and Application crashes on 100th view. But if I keep closing and opening 99 views in same instance of application then after 5 or 6 times the application crashes before 99 views eg on opening 96th or 97th view.
On 2nd machine application is closing abruptly on 19th or 20th view itself.
But if I keep closing and opening lesser than 19 views in same instance of application then also after some time the application will crash.
While debugging I've found that "Unrecoverable Stackoverflow" exception is occurring on "SetWindow" function of "V3d_View"
Both machines are 32bit Windows XP.
Please let me know if anybody has found a solution for this error.

Thanks & Regards,
Gaurav

Forum supervisor's picture

Dear Gaurav,
As you know the corresponding bug (ID==22832) was registered for this issue.
If you can't wait and the problem is critical for you, you may contact us via the Contact Form http://www.opencascade.org/about/contacts/.
We will try to find a solution or workaround acceptable for you.
Regards