diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-07-10 14:59:56 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-07-20 15:27:36 +0300 |
commit | 51e36fa15805fdf64d68113ef66910f3f6c8eede (patch) | |
tree | aa818a071053a5d36aa2ce4d635b646db57c2905 /printer.cpp | |
parent | 85bce0fa0da575040b6e4ef04750475b9a9ae223 (diff) | |
download | subsurface-51e36fa15805fdf64d68113ef66910f3f6c8eede.tar.gz |
Printing: handle memory leak in printer class
Don't initialize new webview each time we print.
Delete the QWebView object in the destructor.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'printer.cpp')
-rw-r--r-- | printer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/printer.cpp b/printer.cpp index f8a90f96d..446a5c29d 100644 --- a/printer.cpp +++ b/printer.cpp @@ -13,6 +13,12 @@ Printer::Printer(QPrinter *printer, print_options *printOptions, template_option this->templateOptions = templateOptions; dpi = 0; done = 0; + webView = new QWebView(); +} + +Printer::~Printer() +{ + delete webView; } void Printer::putProfileImage(QRect profilePlaceholder, QRect viewPort, QPainter *painter, struct dive *dive, QPointer<ProfileWidget2> profile) @@ -118,7 +124,6 @@ void Printer::templateProgessUpdated(int value) void Printer::print() { TemplateLayout t(printOptions, templateOptions); - webView = new QWebView(); connect(&t, SIGNAL(progressUpdated(int)), this, SLOT(templateProgessUpdated(int))); dpi = printer->resolution(); |