Fix crashes that can occur when selecting/copying text (#4153)

This commit is contained in:
pajlada
2022-11-16 00:32:15 +01:00
committed by GitHub
parent 90121ed756
commit 011facc13a
10 changed files with 117 additions and 73 deletions
+10 -12
View File
@@ -108,8 +108,8 @@ ImageLayoutElement::ImageLayoutElement(MessageElement &creator, ImagePtr image,
this->trailingSpace = creator.hasTrailingSpace();
}
void ImageLayoutElement::addCopyTextToString(QString &str, int from,
int to) const
void ImageLayoutElement::addCopyTextToString(QString &str, uint32_t from,
uint32_t to) const
{
const auto *emoteElement =
dynamic_cast<EmoteElement *>(&this->getCreator());
@@ -272,8 +272,8 @@ void TextLayoutElement::listenToLinkChanges()
});
}
void TextLayoutElement::addCopyTextToString(QString &str, int from,
int to) const
void TextLayoutElement::addCopyTextToString(QString &str, uint32_t from,
uint32_t to) const
{
str += this->getText().mid(from, to - from);
@@ -387,8 +387,8 @@ TextIconLayoutElement::TextIconLayoutElement(MessageElement &creator,
{
}
void TextIconLayoutElement::addCopyTextToString(QString &str, int from,
int to) const
void TextIconLayoutElement::addCopyTextToString(QString &str, uint32_t from,
uint32_t to) const
{
}
@@ -513,14 +513,12 @@ int ReplyCurveLayoutElement::getXFromIndex(int index)
{
return this->getRect().left();
}
else
{
return this->getRect().right();
}
return this->getRect().right();
}
void ReplyCurveLayoutElement::addCopyTextToString(QString &str, int from,
int to) const
void ReplyCurveLayoutElement::addCopyTextToString(QString &str, uint32_t from,
uint32_t to) const
{
}