Fixes #3156.
I couldn't reproduce the problem in a "natural" way so I cheated:
1. Start i3 with gdb
2. Set breakpoing on tree_restore
3. Run, open window, i3-msg restart
5. Open the file in *path with a hex editor
6. Edit the "name" field of the window and insert bytes that are not
valid UTF8
7. Continue
After parsing fails, all nodes including croot are incomplete, meaning
they have to be deleted. We can't recover in any reasonable way so we
have to allow non-UTF8 characters to avoid this situation altogether.
yajl_config(hand, yajl_allow_comments, true);
/* Allow multiple values, i.e. multiple nodes to attach */
yajl_config(hand, yajl_allow_multiple_values, true);
+ /* Allow strings that are not valid UTF8. Could be possible if a container
+ * name contains such characters. If yajl stops parsing because of this, an
+ * in-place restart could fail: see #3156. */
+ yajl_config(hand, yajl_dont_validate_strings, true);
json_node = con;
to_focus = NULL;
incomplete = 0;