Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WM5 Crash when I cut shape feature times #139

Closed
ningfc opened this issue Nov 16, 2021 · 9 comments
Closed

WM5 Crash when I cut shape feature times #139

ningfc opened this issue Nov 16, 2021 · 9 comments

Comments

@ningfc
Copy link

ningfc commented Nov 16, 2021

I try to cut shapes multiple times, and crash happend. I'm try to debugging and found the position in MapWinGIS component TableRow::~TableRow(), app crashed with call function VariantClear. But the crash not happened when run MapWinGIS deom application (MapWindowLite.exe) and do the same thing.

And crash no happened when I comments function VariantClear in TableRow::~TableRow().

image

And follow is last few lines of debug output window.
线程 0x1898 已退出,返回值为 0 (0x0)。
OCX: MAP PROJECTION SET: +proj=longlat +datum=WGS84 +no_defs
0x7546EA32 处(位于 MapWindow.exe 中)引发的异常: Microsoft C++ 异常: EEFileLoadException,位于内存位置 0x0059C0B4 处。
0x7546EA32 处(位于 MapWindow.exe 中)引发的异常: Microsoft C++ 异常: [rethrow],位于内存位置 0x00000000 处。
0x7546EA32 处(位于 MapWindow.exe 中)引发的异常: Microsoft C++ 异常: [rethrow],位于内存位置 0x00000000 处。
0x7546EA32 (KernelBase.dll)处(位于 MapWindow.exe 中)引发的异常: 0xE0434352 (参数: 0x80070002, 0x00000000, 0x00000000, 0x00000000, 0x73400000)。

Critical error detected c0000374

MapWindow.exe 已触发了一个断点。

@pmeems
Copy link
Contributor

pmeems commented Nov 16, 2021

Which version of MWGis are you using?
Can you add the code you're using that does the cutting, so we can try to reproduce it?

@ningfc
Copy link
Author

ningfc commented Nov 16, 2021

Which version of MWGis are you using? Can you add the code you're using that does the cutting, so we can try to reproduce it?

MapWindow v5.6.3 with MapWinGIS v5.2.4

@pmeems
Copy link
Contributor

pmeems commented Nov 16, 2021

OK. So you are using MW5 to cut the shapefile.
Do you experience this error with every shapefile or just with one?
And are you cutting the same shape every time or different shapes in the same shapefile?
What kind of shapefile are you cutting: line, polygon?
Can you add the shapefile so we can use it for our tests?

@ningfc
Copy link
Author

ningfc commented Nov 16, 2021

OK. So you are using MW5 to cut the shapefile. Do you experience this error with every shapefile or just with one? And are you cutting the same shape every time or different shapes in the same shapefile? What kind of shapefile are you cutting: line, polygon? Can you add the shapefile so we can use it for our tests?

The shape file type I used is a polyline. and I tried a lot of times in different shapes, and different shape files.
Shape file With UTF8 encoding.
Shape file I used

@ningfc
Copy link
Author

ningfc commented Nov 16, 2021

OK. So you are using MW5 to cut the shapefile. Do you experience this error with every shapefile or just with one? And are you cutting the same shape every time or different shapes in the same shapefile? What kind of shapefile are you cutting: line, polygon? Can you add the shapefile so we can use it for our tests?

The shape file type I used is a polyline. and I tried a lot of times in different shapes, and different shape files. Shape file With UTF8 encoding. Shape file I used

When I Add This line to ignore VT_BSTR. No crash happen. Perhaps this related with BSTR type.
image

@jerryfaust
Copy link

Hello @ningfc, and thank you for the detail you have provided.

I don't think there is anything wrong with the code here. Instead, I think this may related to another issue that I just recently resolved. If you consider this issue in the MapWinGIS Discourse, you will see that the current release is not properly handling Shapefiles that use the UTF-8 encoding. This could account for intermittent errors when trying to clear a BSTR variant, since it may not know the correct length, and is therefore trying to release memory that it doesn't own.

I have not yet submitted my code changes because, although I have now accounted for UTF-8 encoding, I have not yet accounted for Shapefiles that have other encodings. Even so, I could perhaps submit my changes so that, if you are willing, you could get my changes, rebuild the OCX, and see if the error still occurs. Would you be willing to do that?

Thank you, and Regards,
Jerry.

@ningfc
Copy link
Author

ningfc commented Nov 21, 2021

Hello @ningfc, and thank you for the detail you have provided.

I don't think there is anything wrong with the code here. Instead, I think this may related to another issue that I just recently resolved. If you consider this issue in the MapWinGIS Discourse, you will see that the current release is not properly handling Shapefiles that use the UTF-8 encoding. This could account for intermittent errors when trying to clear a BSTR variant, since it may not know the correct length, and is therefore trying to release memory that it doesn't own.

I have not yet submitted my code changes because, although I have now accounted for UTF-8 encoding, I have not yet accounted for Shapefiles that have other encodings. Even so, I could perhaps submit my changes so that, if you are willing, you could get my changes, rebuild the OCX, and see if the error still occurs. Would you be willing to do that?

Thank you, and Regards,

Jerry.

Yes I will,It's my pleasure for test your new changes.

@jerryfaust
Copy link

Hello again.

Code has been checked in to the 'develop' branch to (hopefully) handle issues related to Shapefiles that use the UTF-8 encoding as specified in the Code Page file (.CPG). It will be interesting to know if this resolves your problem as well.

Thank you, and Kind Regards,
Jerry.

@ningfc
Copy link
Author

ningfc commented Nov 23, 2021

Hello again.

Code has been checked in to the 'develop' branch to (hopefully) handle issues related to Shapefiles that use the UTF-8 encoding as specified in the Code Page file (.CPG). It will be interesting to know if this resolves your problem as well.

Thank you, and Kind Regards, Jerry.

I tested your Code, It works fine, saving Shapefile that use the UTF-8 encoding is OK.
My problem may cause by myself code for change variant type to VT_BSTR use VariantChangeType, So sorry. And I just resolved it. It is becouse I use VariantChangeType to a local param, but not a pointer or reference.

Thank you for your patience and help!
Regards to you.

@ningfc ningfc closed this as completed Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants