Revert "Refactor to avoid nonnull checks on "this" pointer."

This reverts commit 0008bdea02.

This patch introduced a regression.  Calling FOO=$(...) in zsh hangs
indefinitely and has to be killed forcefully.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2016-04-05 10:26:06 +02:00
parent 722e363c4d
commit 41abcc5825
9 changed files with 38 additions and 75 deletions

View File

@ -3932,7 +3932,7 @@ fcwd_access_t::Free (PVOID heap)
{
/* Decrement the reference count. If it's down to 0, free
structure from heap. */
if (InterlockedDecrement (&ReferenceCount ()) == 0)
if (this && InterlockedDecrement (&ReferenceCount ()) == 0)
{
/* In contrast to pre-Vista, the handle on init is always a
fresh one and not the handle inherited from the parent
@ -4320,8 +4320,7 @@ cwdstuff::override_win32_cwd (bool init, ULONG old_dismount_count)
f_cwd->CopyPath (upp_cwd_str);
upp_cwd_hdl = dir;
RtlLeaveCriticalSection (peb.FastPebLock);
if (old_cwd)
old_cwd->Free (heap);
old_cwd->Free (heap);
}
else
{