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

fix: fix segfault while trying to send messages

Unfortunately, can not pass local variable on ChatLine::Ptr through
several method calls so ChatMessage inserted after its creating in the
same scope. Updated docs
This commit is contained in:
noavarice 2017-04-26 14:30:22 +03:00
parent 037f66928e
commit b5f4628c89

View File

@ -387,7 +387,7 @@ bool GenericChatForm::needsToHideName(const ToxPk &messageAuthor) const
} }
/** /**
* @brief Creates ChatMessage shared object that later will be inserted into ChatLog * @brief Creates ChatMessage shared object and inserts it into ChatLog
* @param author Author of the message * @param author Author of the message
* @param message Message text * @param message Message text
* @param dt Date and time when message was sent * @param dt Date and time when message was sent
@ -425,6 +425,7 @@ ChatMessage::Ptr GenericChatForm::createMessage(const ToxPk& author, const QStri
msg->markAsSent(dt); msg->markAsSent(dt);
} }
insertChatMessage(msg);
return msg; return msg;
} }
@ -444,7 +445,7 @@ ChatMessage::Ptr GenericChatForm::createSelfMessage(const QString& message, cons
void GenericChatForm::addMessage(const ToxPk& author, const QString& message, const QDateTime& dt, void GenericChatForm::addMessage(const ToxPk& author, const QString& message, const QDateTime& dt,
bool isAction) bool isAction)
{ {
insertChatMessage(createMessage(author, message, dt, isAction, true)); createMessage(author, message, dt, isAction, true);
} }
/** /**
@ -453,7 +454,7 @@ void GenericChatForm::addMessage(const ToxPk& author, const QString& message, co
void GenericChatForm::addSelfMessage(const QString& message, const QDateTime& datetime, void GenericChatForm::addSelfMessage(const QString& message, const QDateTime& datetime,
bool isAction) bool isAction)
{ {
insertChatMessage(createSelfMessage(message, datetime, isAction, true)); createSelfMessage(message, datetime, isAction, true);
} }
void GenericChatForm::addAlertMessage(const ToxPk& author, const QString& msg, const QDateTime& dt) void GenericChatForm::addAlertMessage(const ToxPk& author, const QString& msg, const QDateTime& dt)