diff options
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol_p.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index b730b415f0..f4df95865d 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -280,6 +280,13 @@ public: cancelPasswordEchoTimer(); m_echoMode = mode; m_passwordEchoEditing = false; + + // If this control is used for password input, we want to minimize + // the possibility of string reallocation not to leak (parts of) + // the password. + if (m_echoMode != QLineEdit::Normal) + m_text.reserve(30); + updateDisplayText(); } |