gkeyfile: remain usable after g_key_file_free()

Previously, in the case where 'kf' has more than one ref, calling
g_key_file_free(kf) would break it. For example, calling
g_key_file_has_key(kf, ...) would hit the following assertion:

    g_hash_table_lookup: assertion 'hash_table != NULL' failed

This is because g_key_file_free() calls g_key_file_clear() which sets
self->groups and other fields to NULL; most lookup functions assume
these fields are non-NULL.

One fix would be to call g_key_file_init() right after
g_key_file_clear() in g_key_file_free(). However, in the case where
there are no other refs to the keyfile, this would mean allocating
many new hash tables which will be immediately destroyed when
g_key_file_unref() removes the last ref. Instead, inline the unref, and
re-initialize the internal state when the keyfile is still alive.
9 jobs for <span class="ref-name">2-58-339-key-file-free-fix</span> in 15 minutes and 18 seconds (queued for 5 seconds)
Status Job ID Name Coverage
  Build
passed #114882
cross-android_api21_arm64

00:07:31

passed #114883
cross-android_api28_arm64

00:07:07

passed #114884
cross-mingw64

00:06:57

passed #114881
fedora-autotools-x86_64

00:10:58

passed #114880
fedora-x86_64

00:11:36

manual #114887
freebsd-11 allowed to fail manual
freebsd-11-x86_64
passed #114885
win32
msys2-mingw32

00:08:20

passed #114886
win32
vs2017-x64

00:05:53

 
  Coverage
passed #114888
coverage

00:00:51

73.5%