backport from trunk (rev #9677)

fixed race condition that would lead to invalid memory access when using dialog pinging