Hi,
there are 2 possible cases:
If you are sure that void DistanceThread::run() exit after first iteration then you are setting "flagforbreak" or "diststop" in between. So could you please check the slots of those signals which you are emitting? (May be the flag set from there).
DistanceThread::run() is still executing but your conditions (i saw complex nested "If"s there :) ) may not meet anytime.(Hope U will debug it ensure that.
Regards,
Rajeesh Raveendran