Fix #257: Windows 7: SIPE crashes after a minute
When trying to simulate the same situation, i.e. all EWS autodiscover
attempts fail with a DNS error, I noticed a slight difference between my
debug logs and the debug logs provided by the reporters.
I can only explain this difference if g_hash_table_remove() calls the
value destroy callback *before* removing the hash table entry. In our
case the destroy callback triggers the EWS HTTP callback which
immediately generates another HTTP request. In one situation that new
HTTP request has the same host:port key as the just "removed" entry and
the SIPE HTTP stack tries to re-establish the connection which is
actually already invalid.
Circumvent this race condition by using g_hash_table_steal() and calling
the value destroy callback by hand.
(cherry picked from commit
3893f9589a0440d89f0c9519f5b46b2e6d947a37)