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

fixed potential null deref. & memory leak

This commit is contained in:
krepa098 2015-01-19 10:07:51 +01:00
parent 5429e50bd0
commit 691a8b0b71

View File

@ -217,6 +217,9 @@ void Text::mousePressEvent(QGraphicsSceneMouseEvent *event)
void Text::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if(!doc)
return;
QString anchor = doc->documentLayout()->anchorAt(event->pos());
// open anchors in browser
@ -231,11 +234,15 @@ QString Text::getText() const
void Text::ensureIntegrity()
{
if(!doc || dirty)
if(!doc)
{
doc = new CustomTextDocument();
doc->setDefaultFont(defFont);
dirty = true;
}
if(dirty)
{
if(!elide)
{
doc->setHtml(text);