File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -84,17 +84,17 @@ void QtHtmlReader::Open()
8484 text_document.setTextWidth (width);
8585 text_document.setDefaultStyleSheet (css.c_str ());
8686 text_document.setHtml (html.c_str ());
87-
87+
8888 int td_height = text_document.documentLayout ()->documentSize ().height ();
89-
89+
9090 if (gravity == GRAVITY_TOP_LEFT || gravity == GRAVITY_TOP || gravity == GRAVITY_TOP_RIGHT) {
9191 painter.translate (x_offset, y_offset);
9292 } else if (gravity == GRAVITY_LEFT || gravity == GRAVITY_CENTER || gravity == GRAVITY_RIGHT) {
9393 painter.translate (x_offset, (height - td_height) / 2 + y_offset);
9494 } else if (gravity == GRAVITY_BOTTOM_LEFT || gravity == GRAVITY_BOTTOM_RIGHT || gravity == GRAVITY_BOTTOM) {
9595 painter.translate (x_offset, height - td_height + y_offset);
9696 }
97-
97+
9898 if (gravity == GRAVITY_TOP_LEFT || gravity == GRAVITY_LEFT || gravity == GRAVITY_BOTTOM_LEFT) {
9999 text_document.setDefaultTextOption (QTextOption (Qt::AlignLeft));
100100 } else if (gravity == GRAVITY_CENTER || gravity == GRAVITY_TOP || gravity == GRAVITY_BOTTOM) {
@@ -216,6 +216,8 @@ void QtHtmlReader::SetJson(std::string value) {
216216 std::string errors;
217217 bool success = reader->parse ( value.c_str (),
218218 value.c_str () + value.size (), &root, &errors );
219+ delete reader;
220+
219221 if (!success)
220222 // Raise exception
221223 throw InvalidJSON (" JSON could not be parsed (or is invalid)" , " " );
Original file line number Diff line number Diff line change @@ -224,6 +224,8 @@ void QtTextReader::SetJson(std::string value) {
224224 std::string errors;
225225 bool success = reader->parse ( value.c_str (),
226226 value.c_str () + value.size (), &root, &errors );
227+ delete reader;
228+
227229 if (!success)
228230 // Raise exception
229231 throw InvalidJSON (" JSON could not be parsed (or is invalid)" , " " );
You can’t perform that action at this time.
0 commit comments