diff options
author | Chris Davis <cd.rattan@gmail.com> | 2014-06-27 18:01:36 -0700 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2014-10-01 14:32:08 +0200 |
commit | 75045f052a5bc00fc8ffe35514c60e2f1611c9e9 (patch) | |
tree | 4fae0d2fb6c16cb47066b4907311f3d88488dae2 /source3/utils | |
parent | 2a8beb99a49829adfbad1c887448e3a2caa32255 (diff) | |
download | samba-75045f052a5bc00fc8ffe35514c60e2f1611c9e9.tar.gz samba-75045f052a5bc00fc8ffe35514c60e2f1611c9e9.tar.xz samba-75045f052a5bc00fc8ffe35514c60e2f1611c9e9.zip |
regedit: reopen parent keys when adding or removing subkeys
This clears any cache associated with the parent key,
and ensures the changes will be noticed by the UI.
Signed-off-by: Chris Davis <cd.rattan@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/regedit.c | 5 | ||||
-rw-r--r-- | source3/utils/regedit_treeview.c | 9 | ||||
-rw-r--r-- | source3/utils/regedit_treeview.h | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/source3/utils/regedit.c b/source3/utils/regedit.c index 471f875db2..b006fac848 100644 --- a/source3/utils/regedit.c +++ b/source3/utils/regedit.c @@ -230,6 +230,10 @@ static void add_reg_key(struct regedit *regedit, struct tree_node *node, name, new_key); SMB_ASSERT(new_node); tree_node_insert_sorted(list, new_node); + } else { + /* Reopen the parent key to make sure the + new subkey will be noticed. */ + tree_node_reopen_key(parent); } list = tree_node_first(node); @@ -419,6 +423,7 @@ static void handle_tree_input(struct regedit *regedit, int c) rv = reg_key_del(node, parent->key, node->name); if (W_ERROR_IS_OK(rv)) { + tree_node_reopen_key(parent); tree_view_clear(regedit->keys); pop = tree_node_pop(&node); tree_node_free_recursive(pop); diff --git a/source3/utils/regedit_treeview.c b/source3/utils/regedit_treeview.c index c8a65965bc..3af3c8b59c 100644 --- a/source3/utils/regedit_treeview.c +++ b/source3/utils/regedit_treeview.c @@ -141,6 +141,15 @@ static uint32_t get_num_subkeys(struct tree_node *node) return 0; } +WERROR tree_node_reopen_key(struct tree_node *node) +{ + SMB_ASSERT(node->parent != NULL); + SMB_ASSERT(node->name != NULL); + TALLOC_FREE(node->key); + return reg_open_key(node->parent, node->parent->key, node->name, + &node->key); +} + bool tree_node_has_children(struct tree_node *node) { if (node->child_head) { diff --git a/source3/utils/regedit_treeview.h b/source3/utils/regedit_treeview.h index cd17a3c265..954bae5ec7 100644 --- a/source3/utils/regedit_treeview.h +++ b/source3/utils/regedit_treeview.h @@ -66,6 +66,7 @@ void tree_view_resize(struct tree_view *view, int nlines, int ncols, void tree_view_show(struct tree_view *view); void tree_view_clear(struct tree_view *view); WERROR tree_view_update(struct tree_view *view, struct tree_node *list); +WERROR tree_node_reopen_key(struct tree_node *node); bool tree_node_has_children(struct tree_node *node); WERROR tree_node_load_children(struct tree_node *node); void tree_node_insert_sorted(struct tree_node *list, struct tree_node *node); |