gui: PreviewResult*: Wrap result in shared pointer immediatly
This commit is contained in:
부모
abce4cfcd9
커밋
9686ef30c7
@ -30,7 +30,7 @@ QByteArray PreviewResultPdf::serialize() const
|
||||
|
||||
QSharedPointer<PreviewResultPdf> PreviewResultPdf::deserialize(QByteArray &ba)
|
||||
{
|
||||
PreviewResultPdf *result = new PreviewResultPdf();
|
||||
QSharedPointer<PreviewResultPdf> result(new PreviewResultPdf());
|
||||
PreviewResultType type;
|
||||
|
||||
QDataStream stream{&ba, QIODevice::ReadOnly};
|
||||
@ -40,5 +40,5 @@ QSharedPointer<PreviewResultPdf> PreviewResultPdf::deserialize(QByteArray &ba)
|
||||
throw std::runtime_error("Invalid byte array: Not a pdf preview");
|
||||
}
|
||||
stream >> result->documentPath >> result->page >> result->previewImage;
|
||||
return QSharedPointer<PreviewResultPdf>(result);
|
||||
return result;
|
||||
}
|
||||
|
@ -40,7 +40,8 @@ QByteArray PreviewResultPlainText::serialize() const
|
||||
|
||||
QSharedPointer<PreviewResultPlainText> PreviewResultPlainText::deserialize(QByteArray &ba)
|
||||
{
|
||||
PreviewResultPlainText *result = new PreviewResultPlainText();
|
||||
QSharedPointer<PreviewResultPlainText> result(new PreviewResultPlainText());
|
||||
|
||||
PreviewResultType type;
|
||||
|
||||
QDataStream stream{&ba, QIODevice::ReadOnly};
|
||||
@ -50,5 +51,5 @@ QSharedPointer<PreviewResultPlainText> PreviewResultPlainText::deserialize(QByte
|
||||
throw std::runtime_error("Invalid byte array: Not a pdf preview");
|
||||
}
|
||||
stream >> result->documentPath >> result->page >> result->text;
|
||||
return QSharedPointer<PreviewResultPlainText>(result);
|
||||
return result;
|
||||
}
|
||||
|
불러오는 중...
Reference in New Issue
Block a user