-
Notifications
You must be signed in to change notification settings - Fork 869
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
fix err fileExt evoke panic #55
Conversation
a better idea:(imgcodecs.go)
|
Hello @cnjack looks like the Windows version of the test you added failed: Perhaps it is more sensitive about the extension syntax |
|
That figures... well options are to remove the try/catch entirely, or add some conditional platform specific code in the C++. What do you think? |
The Appveyor build appears to be using shared libs
https://github.com/hybridgroup/gocv/blob/master/appveyor_build_opencv.cmd#L13 |
Codecov Report
@@ Coverage Diff @@
## dev #55 +/- ##
==========================================
- Coverage 96.93% 96.91% -0.03%
==========================================
Files 12 12
Lines 913 907 -6
==========================================
- Hits 885 879 -6
Misses 28 28
Continue to review full report at Codecov.
|
maybe mingw can not use |
I just commented here on this Go issue, seems like applies to this PR: golang/go#13672 (comment) |
get it, may be it's ok in go1.10 |
Hi @cnjack I do not think this will be fixed anytime soon in Go itself, from all the comments on those issues. However, thanks to replies from @ianlancetaylor a possible solution might be to simply not perform any operations that result in memory allocations taking place in the try/catch block. E.g. something like this: struct ByteArray Image_IMEncode(const char* fileExt, Mat img) {
std::vector<uchar> data;
try{
cv::imencode(fileExt, *img, data);
return toByteArray(reinterpret_cast<const char*>(&data[0]), data.size());
} catch(...) {
// do not allocate memory here, just pass thru...
}
// the following line should only be reached in the case that an exception was encountered...
return toByteArray(NULL, 0);
} That might not be best way to structure the code, but it illustrates a technique that might work. Worth a try, I think. |
I will try soon |
sadly, it's not work |
Oh well. At least we tried that, thanks for making the effort. |
is ok, wait the go fix the problem, the last pr #54 may avoid problems such as these |
No description provided.