1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge pull request #3424

Colomban Wendling (1):
      refactor(passwordedit): optimize event handler unregistration
This commit is contained in:
sudden6 2016-06-28 19:03:13 +02:00
commit 4f493c5df7
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -42,10 +42,11 @@ void PasswordEdit::registerHandler()
void PasswordEdit::unregisterHandler()
{
#ifdef ENABLE_CAPSLOCK_INDICATOR
if (eventHandler && eventHandler->actions.contains(action))
int idx;
if (eventHandler && (idx = eventHandler->actions.indexOf(action)) >= 0)
{
//TODO: future: use removeOne() when Qt 5.3 (Debian 8) support ends.
eventHandler->actions.remove(eventHandler->actions.indexOf(action));
eventHandler->actions.remove(idx);
if (eventHandler->actions.isEmpty())
{
delete eventHandler;