Skip to content
Snippets Groups Projects
Commit 37acb0ca authored by Campbell Barton's avatar Campbell Barton Committed by Gitea
Browse files

Fix #112399: Memory leak with exceptions from scripts in the text editor

Regression in [0] caused the function to jump to the error in the text
editor not to restore the exception, using the trace-back being iterated
over instead of the original value.

[0]: 2d2baeaf

Pull Request: https://projects.blender.org/blender/blender/pulls/112708
parent a5c5ec60
No related branches found
No related tags found
No related merge requests found
......@@ -216,12 +216,12 @@ bool python_script_error_jump(
else {
PyErr_NormalizeException(&exception, &value, (PyObject **)&tb);
for (tb = (PyTracebackObject *)PySys_GetObject("last_traceback");
tb && (PyObject *)tb != Py_None;
tb = tb->tb_next)
for (PyTracebackObject *tb_iter = (PyTracebackObject *)PySys_GetObject("last_traceback");
tb_iter && (PyObject *)tb_iter != Py_None;
tb_iter = tb_iter->tb_next)
{
PyObject *coerce;
const char *tb_filepath = traceback_filepath(tb, &coerce);
const char *tb_filepath = traceback_filepath(tb_iter, &coerce);
const int match = ((BLI_path_cmp(tb_filepath, filepath) == 0) ||
(ELEM(tb_filepath[0], '\\', '/') &&
BLI_path_cmp(tb_filepath + 1, filepath) == 0));
......@@ -229,7 +229,7 @@ bool python_script_error_jump(
if (match) {
success = true;
*r_lineno = *r_lineno_end = tb->tb_lineno;
*r_lineno = *r_lineno_end = tb_iter->tb_lineno;
/* used to break here, but better find the inner most line */
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment