[poppler] Object management helper class
Albert Astals Cid
aacid at kde.org
Mon May 30 21:13:31 UTC 2016
El diumenge, 29 de maig de 2016, a les 19:52:29 CEST, William Bader va
escriure:
> I think that anything to reduce the chance of memory issues is good, but you
> might risk support for older systems. gcc-4.1.2 on RHEL5 does not have
> unique_ptr. gcc-4.4.4 on RHEL6 has unique_ptr. William
In my opinion people that get paid for supporting old systems can earn they
money if someone needs a new poppler in an old RHEL.
Cheers,
Albert
>
> > From: aacid at kde.org
> > To: poppler at lists.freedesktop.org
> > Date: Sun, 29 May 2016 22:57:13 +0200
> > Subject: [poppler] Object management helper class
> >
> > Hi guys, related to the previous email about std::unique_ptr I think we
> > would greatly benefit of a class that makes Object management easier.
> >
> > Again if you go and check https://bugs.freedesktop.org/attachment.cgi?
> > id=124163 we're missing lots of free() and it's hard to prove we won't
> > miss
> > more.
> >
> > My suggestion is adding a class called UniqueObject (better name welcome)
> >
> > which will:
> > * Call free on itself when it goes out of scope
> >
> > So we don't need to add .free() in every other if-chek-error-return
> >
> > * Call free on itself when you write on it
> >
> > So we can do
> >
> > dict->lookup("Decode", &obj1);
> >
> > if (obj1.isNull()) {
> >
> > dict->lookup("D", &obj1);
> >
> > }
> >
> > instead of
> >
> > dict->lookup("Decode", &obj1);
> >
> > if (obj1.isNull()) {
> >
> > obj1.free();
> > dict->lookup("D", &obj1);
> >
> > }
> >
> > What do you think?
> >
> > Cheers,
> >
> > Albert
More information about the poppler
mailing list