mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-28 09:13:08 +03:00
Avoid NULL deref when deleting a node, causing empty ancestor nodes to be deleted.
This commit is contained in:
parent
2a4fb9ecd1
commit
69e3963dae
@ -1185,13 +1185,14 @@ nserror treeview_delete_node(treeview *tree, treeview_node *n,
|
|||||||
{
|
{
|
||||||
nserror err;
|
nserror err;
|
||||||
struct rect r;
|
struct rect r;
|
||||||
treeview_node *p;
|
bool visible;
|
||||||
|
|
||||||
assert(tree != NULL);
|
assert(tree != NULL);
|
||||||
assert(n != NULL);
|
assert(n != NULL);
|
||||||
assert(n->parent != NULL);
|
assert(n->parent != NULL);
|
||||||
|
|
||||||
p = n->parent;
|
visible = n->parent->flags & TREE_NODE_EXPANDED;
|
||||||
|
|
||||||
r.y0 = treeview_node_y(tree, n);
|
r.y0 = treeview_node_y(tree, n);
|
||||||
r.y1 = tree->root->height;
|
r.y1 = tree->root->height;
|
||||||
|
|
||||||
@ -1217,8 +1218,7 @@ nserror treeview_delete_node(treeview *tree, treeview_node *n,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Redraw */
|
/* Redraw */
|
||||||
if (p->flags & TREE_NODE_EXPANDED &&
|
if (visible && !(flags & TREE_OPTION_SUPPRESS_REDRAW)) {
|
||||||
!(flags & TREE_OPTION_SUPPRESS_REDRAW)) {
|
|
||||||
r.x0 = 0;
|
r.x0 = 0;
|
||||||
r.x1 = REDRAW_MAX;
|
r.x1 = REDRAW_MAX;
|
||||||
tree->cw_t->redraw_request(tree->cw_h, &r);
|
tree->cw_t->redraw_request(tree->cw_h, &r);
|
||||||
|
Loading…
Reference in New Issue
Block a user