A Potential "Division by zero" exception in QPlainTextEditPrivate line 976
If QPlainTextEdit is used with a Courier font like this:
This yields divide by zero when GetTextMetrics fails. It flags a diagnostic message "Error: QFontEngineWin: GetTextMetrics failed ()" and then crashes with a "Division by zero" exception with following stack trace:
The logic of the problem is quite clear:
1. It is anticipated that GetTextMetrics() may fail (for whatever reason) and
then the QFontMetrics are zeroed.Commit: #eb39ecc in src/gui/text/qfontengine_win.cpp
2. If this happens, QFontMetrics::lineSpacing() returns 0, and if this occurs in _q_adjustScrollbars(), the application will crash.