Commit 155f73bd authored by Albert Astals Cid's avatar Albert Astals Cid

Fix crash in destruction of standalone forms

If we just give the Dict to Object() it doesn't increase the ref
so on destruction we do one unref too much (because we had done one ref
too few) and crash
parent 4098c654
......@@ -21,7 +21,7 @@
// Copyright (C) 2008 Hugo Mercier <hmercier31@gmail.com>
// Copyright (C) 2008 Pino Toscano <pino@kde.org>
// Copyright (C) 2008 Tomas Are Haavet <tomasare@gmail.com>
// Copyright (C) 2009-2011, 2013, 2016-2019 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009-2011, 2013, 2016-2020 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2012, 2013 Fabio D'Urso <fabiodurso@hotmail.it>
// Copyright (C) 2012, 2015 Tobias Koenig <tokoe@kdab.com>
// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
......@@ -697,7 +697,7 @@ public:
PDFDoc *getDoc() const { return doc; }
bool getHasRef() const { return hasRef; }
Ref getRef() const { return ref; }
Dict *getDict() const { return annotObj.getDict(); }
const Object &getAnnotObj() const { return annotObj; }
AnnotSubtype getType() const { return type; }
PDFRectangle *getRect() const { return rect.get(); }
void getRect(double *x1, double *y1, double *x2, double *y2) const;
......
......@@ -15,7 +15,7 @@
//
// Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2005 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2005-2013, 2016-2019 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2005-2013, 2016-2020 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006-2008 Pino Toscano <pino@kde.org>
// Copyright (C) 2006 Nickolay V. Shmyrev <nshmyrev@yandex.ru>
// Copyright (C) 2006 Scott Turner <scotty1024@mac.com>
......@@ -378,7 +378,7 @@ void Page::loadStandaloneFields(Annots *annotations, Form *form) {
continue; // this annot is referenced inside Form, skip it
std::set<int> parents;
FormField *field = Form::createFieldFromDict (Object(annot->getDict()),
FormField *field = Form::createFieldFromDict (annot->getAnnotObj().copy(),
annot->getDoc(), r, nullptr, &parents);
if (field && field->getType() == formButton && field->getNumWidgets() == 1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment