Fixed an infinite loop that could occur with the debug callback in a 4.* debug context

Status Job ID Name Coverage
  Test
passed #2637
Linux
clang-c++11-debug

00:00:13

passed #2639
Linux
clang-c++11-release

00:00:14

passed #2636
Linux
gcc-c++11-debug

00:01:32

passed #2638
Linux
gcc-c++11-release

00:01:38