Skip to content

Commit

Permalink
[Azoth OTRoid] Avoid reusing already-deleted Authenticators.
Browse files Browse the repository at this point in the history
Fixes occasional crashes.
  • Loading branch information
0xd34df00d committed Oct 14, 2014
1 parent c4eab4c commit 0fba4c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/plugins/azoth/plugins/otroid/otrhandler.cpp
Expand Up @@ -775,6 +775,10 @@ namespace OTRoid
SIGNAL (initiateRequested (ICLEntry*, SmpMethod, QString, QString)),
this,
SLOT (startAuth (ICLEntry*, SmpMethod, QString, QString)));
connect (auth,
SIGNAL (destroyed ()),
this,
SLOT (handleAuthDestroyed ()));
Auths_ [entry] = auth;
}
#endif
Expand Down Expand Up @@ -974,6 +978,13 @@ namespace OTRoid
}
}

void OtrHandler::handleAuthDestroyed ()
{
const auto auth = static_cast<Authenticator*> (sender ());
const auto key = Auths_.key (auth);
Auths_.remove (key);
}

void OtrHandler::handleGotSmpReply (SmpMethod, const QString& reply, ConnContext *context)
{
const auto& replyUtf = reply.toUtf8 ();
Expand Down
1 change: 1 addition & 0 deletions src/plugins/azoth/plugins/otroid/otrhandler.h
Expand Up @@ -145,6 +145,7 @@ namespace OTRoid
#if OTRL_VERSION_MAJOR >= 4
void handleAuthRequested ();
void startAuth (ICLEntry*, SmpMethod, const QString&, const QString&);
void handleAuthDestroyed ();

void handleGotSmpReply (SmpMethod, const QString&, ConnContext*);
void handleAbortSmp (ConnContext*);
Expand Down

0 comments on commit 0fba4c7

Please sign in to comment.