Commit e9278387 authored by Oliver Sander's avatar Oliver Sander Committed by Albert Astals Cid

Use a std::string value in LinkHide

parent 9c8d0511
......@@ -872,13 +872,14 @@ LinkOCGState::LinkOCGState(const Object *obj)
//------------------------------------------------------------------------
LinkHide::LinkHide(const Object *hideObj) {
targetName = nullptr;
hasTargetNameFlag = false;
show = false; // Default
if (hideObj->isDict()) {
const Object targetObj = hideObj->dictLookup("T");
if (targetObj.isString()) {
targetName = targetObj.getString()->copy();
targetName = targetObj.getString()->toStr();
hasTargetNameFlag = true;
}
const Object shouldHide = hideObj->dictLookup("H");
if (shouldHide.isBool()) {
......@@ -887,10 +888,6 @@ LinkHide::LinkHide(const Object *hideObj) {
}
}
LinkHide::~LinkHide() {
delete targetName;
}
//------------------------------------------------------------------------
// LinkUnknown
//------------------------------------------------------------------------
......
......@@ -470,9 +470,7 @@ class LinkHide: public LinkAction {
public:
LinkHide(const Object *hideObj);
~LinkHide() override;
bool isOk() const override { return targetName != nullptr; }
bool isOk() const override { return hasTargetNameFlag; }
LinkActionKind getKind() const override { return actionHide; }
// According to spec the target can be either:
......@@ -484,14 +482,16 @@ public:
// While b / c appear to be very uncommon and can't easily be
// created with Adobe Acrobat DC. So only support hide
// actions with named targets (yet).
bool hasTargetName() const { return targetName != nullptr; }
const GooString *getTargetName() const { return targetName; }
bool hasTargetName() const { return hasTargetNameFlag; }
const std::string& getTargetName() const { return targetName; }
// Should this action show or hide.
bool isShowAction() const { return show; }
private:
GooString *targetName;
bool hasTargetNameFlag;
std::string targetName;
bool show;
};
......
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