notsecure/uTox — pull request #315 by FRIGN (2014-08-27 12:25:01+00:00)
Title: Fix freezing on all platforms

##Abstract
When edit_draw is called, it could happen that a negative value
is passed to text_height as the first argument, effectively
leading to an infinite loop.

To prevent this, the possibility is checked directly at the
beginning of the function.

The reason why this went unnoticed so long is the fact that
the wmhints prevent the window from ever being scaled to such
a small size to trigger this bug.
However, I came to notice this issue, because a tiling-wm
overrides the wmhints, which effectively lead to the freeze
once the window was small enough.

Relying on the hints to shadow bugs for you is not the way
to go and explicitly breaks the ICCCM-conventions.

##How to reproduce
Disable wmhints in xlib/main.c:696 and rescale the window to a
really small size.
You'll notice that it freezes and uses 100% CPU.

##Also resolves
Fixing this freezing bug should sort out other issues
reported for other platforms in regard to freezing.

Please check if the issues still exist:
https://github.com/notsecure/uTox/issues/313
https://github.com/notsecure/uTox/issues/262
https://github.com/notsecure/uTox/issues/246