diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2011-03-15 22:02:06 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2011-03-15 22:02:06 +0000 |
commit | 1da7b161f8eb8e2afbb46e9e2904dc3973fc2458 (patch) | |
tree | b8e3f8f4fdd19d316c12dc39d515f053a6723a9a /desktop | |
parent | b69816ff79aec1a472cdb184c45452d6926cf6f7 (diff) | |
download | netsurf-1da7b161f8eb8e2afbb46e9e2904dc3973fc2458.tar.gz netsurf-1da7b161f8eb8e2afbb46e9e2904dc3973fc2458.tar.bz2 |
Stop gtk printing from exploding if its unable to initialise the job
add interface to clone a high level cache handle
make generic printing core call new hlcache interface
svn path=/trunk/netsurf/; revision=12068
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/print.c | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/desktop/print.c b/desktop/print.c index fbc0c4790..ab36f24f1 100644 --- a/desktop/print.c +++ b/desktop/print.c @@ -159,43 +159,11 @@ bool print_draw_next_page(const struct printer *printer, hlcache_handle *print_init(hlcache_handle *content, struct print_settings *settings) { -#ifdef FIX_CORE_PRINTING hlcache_handle* printed_content; - hlcache_handle_user *user_sentinel; - - content_add_user(content, NULL, (intptr_t) print_init, 0); - - printed_content = talloc_memdup(content, content, sizeof *content); - - if (!printed_content) - return NULL; - - printed_content->data.html.bw = 0; - - user_sentinel = talloc(printed_content, hlcache_handle_user); - user_sentinel->callback = 0; - user_sentinel->p1 = user_sentinel->p2 = 0; - user_sentinel->next = 0; - printed_content->user_list = user_sentinel; - content_add_user(printed_content, NULL, (intptr_t)print_init, 0); - - printed_content->data.html.layout = - box_duplicate_tree(content->data.html.layout, - printed_content); - - if (!printed_content->data.html.layout) { - talloc_free(printed_content); - return NULL; - } - - assert(settings->font_func != NULL); - - printed_content->data.html.font_func = settings->font_func; + hlcache_handle_clone(content, &printed_content); + return printed_content; -#else - return NULL; -#endif } /** @@ -240,21 +208,16 @@ bool print_apply_settings(hlcache_handle *content, bool print_cleanup(hlcache_handle *content, const struct printer *printer, struct print_settings *settings) { -#ifdef FIX_CORE_PRINTING printer->print_end(); html_redraw_printing = false; if (printed_content) { - content_remove_user(printed_content, NULL, print_init); - talloc_free(printed_content); + hlcache_handle_release(printed_content); } - content_remove_user(content, NULL, print_init); - free((void *)settings->output); free(settings); -#endif return true; } |