-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix unhandled C++ exception #13289
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 unhandled C++ exception #13289
Conversation
The C++ new operator will throw an C++ exception when the memory allocation fails.
src/_tkagg.cpp
Outdated
try { | ||
destbuffer = new agg::int8u[deststride * destheight]; | ||
} | ||
catch (...) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to catch everything? Is std::bad_alloc
not enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! |
…289-on-v3.0.x Backport PR #13289 on branch v3.0.x (Fix unhandled C++ exception)
try { | ||
destbuffer = new agg::int8u[deststride * destheight]; | ||
} | ||
catch (std::bad_alloc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have been a catch-by-reference; right now gcc warns:
src/_tkagg.cpp: In function ‘int PyAggImagePhoto(ClientData, Tcl_Interp*, int, char**)’:
src/_tkagg.cpp:121:21: warning: catching polymorphic type ‘class std::bad_alloc’ by value [-Wcatch-value=]
catch (std::bad_alloc) {
The C++ new operator will throw an C++ exception when the memory allocation fails.
PR Summary
PR Checklist