8000 Merge pull request #13347 from meeseeksmachine/auto-backport-of-pr-13… · matplotlib/matplotlib@d316c74 · GitHub
[go: up one dir, main page]

Skip to content

Commit d316c74

Browse files
authored
Merge pull request #13347 from meeseeksmachine/auto-backport-of-pr-13289-on-v3.0.x
Backport PR #13289 on branch v3.0.x (Fix unhandled C++ exception)
2 parents 6f0b80c + 46b8d34 commit d316c74

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/_tkagg.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ static int PyAggImagePhoto(ClientData clientdata, Tcl_Interp *interp, int
111111
destheight = (int)(y2 - y1);
112112
deststride = 4 * destwidth;
113113

114-
destbuffer = new agg::int8u[deststride * destheight];
115-
if (destbuffer == NULL) {
114+
try {
115+
destbuffer = new agg::int8u[deststride * destheight];
116+
}
117+
catch (std::bad_alloc) {
116118
TCL_APPEND_RESULT(interp, "could not allocate memory", (char *)NULL);
117119
return TCL_ERROR;
118120
}

0 commit comments

Comments
 (0)
0