Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect empty subnamespaces in [clear_global_variable] (bug #21093)
Once they become empty, there is no config left behind to clear, which causes persist_context::get_node() to consistently return NULL. Previously, this caused a straight null pointer dereference; in order to guard against undefined behavior, an assertion check was added to properly terminate execution first. Neither solution is correct. My understanding of this unwiedly mess is that persist_file_context::clear_var() recurses outwards from the original target pruning empty subnamespaces. At some point we are going to run out of things to delete, so just quit the recursion at that point and return to the caller and everything should be fine (or so it was in my test runs with different subnamespace layouts). (In general, the fact that this code completely lacks documentation of any sort and has several non-obvious layers to it is a *really* bad sign for maintainability of this feature in the future. Furthermore, this is not the first time we have had problems with glogal variables nested in subnamespaces -- see bug #20385, which was arguably more disastrous in practice.)
- Loading branch information