git.asbjorn.biz
/
swftools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
cd969c4
)
destroy globalparams if no pdf is currently open
author
kramm
<kramm>
Sat, 20 Oct 2007 17:12:13 +0000
(17:12 +0000)
committer
kramm
<kramm>
Sat, 20 Oct 2007 17:12:13 +0000
(17:12 +0000)
lib/pdf/pdf.cc
patch
|
blob
|
history
diff --git
a/lib/pdf/pdf.cc
b/lib/pdf/pdf.cc
index
25a1770
..
f06949e
100644
(file)
--- a/
lib/pdf/pdf.cc
+++ b/
lib/pdf/pdf.cc
@@
-115,6
+115,8
@@
void pdfpage_rendersection(gfxpage_t*page, gfxdevice_t*output, gfxcoord_t x, gfx
pi->outputDev->setDevice(0);
}
pi->outputDev->setDevice(0);
}
+static int globalparams_count=0;
+
void pdf_doc_destroy(gfxdocument_t*gfx)
{
pdf_doc_internal_t*i= (pdf_doc_internal_t*)gfx->internal;
void pdf_doc_destroy(gfxdocument_t*gfx)
{
pdf_doc_internal_t*i= (pdf_doc_internal_t*)gfx->internal;
@@
-135,6
+137,13
@@
void pdf_doc_destroy(gfxdocument_t*gfx)
free(global_page_range);
global_page_range = 0;
}
free(global_page_range);
global_page_range = 0;
}
+
+ globalparams_count--;
+ if(!globalparams_count) {
+ delete globalParams;
+ globalParams = 0;
+ globalparams_count = 0;
+ }
}
void pdf_doc_set_parameter(gfxdocument_t*gfx, const char*name, const char*value)
}
void pdf_doc_set_parameter(gfxdocument_t*gfx, const char*name, const char*value)
@@
-300,6
+309,11
@@
static void pdf_set_parameter(const char*name, const char*value)
static gfxdocument_t*pdf_open(const char*filename)
{
static gfxdocument_t*pdf_open(const char*filename)
{
+ if(!globalParams) {
+ globalParams = new GFXGlobalParams();
+ globalparams_count++;
+ }
+
gfxdocument_t*pdf_doc = (gfxdocument_t*)malloc(sizeof(gfxdocument_t));
memset(pdf_doc, 0, sizeof(gfxdocument_t));
pdf_doc_internal_t*i= (pdf_doc_internal_t*)malloc(sizeof(pdf_doc_internal_t));
gfxdocument_t*pdf_doc = (gfxdocument_t*)malloc(sizeof(gfxdocument_t));
memset(pdf_doc, 0, sizeof(gfxdocument_t));
pdf_doc_internal_t*i= (pdf_doc_internal_t*)malloc(sizeof(pdf_doc_internal_t));
@@
-383,10
+397,6
@@
static gfxdocument_t*pdf_open(const char*filename)
gfxsource_t*gfxsource_pdf_create()
{
gfxsource_t*gfxsource_pdf_create()
{
- if(!globalParams) {
- globalParams = new GFXGlobalParams();
- }
-
gfxsource_t*src = (gfxsource_t*)malloc(sizeof(gfxsource_t));
memset(src, 0, sizeof(gfxsource_t));
src->set_parameter = pdf_set_parameter;
gfxsource_t*src = (gfxsource_t*)malloc(sizeof(gfxsource_t));
memset(src, 0, sizeof(gfxsource_t));
src->set_parameter = pdf_set_parameter;