mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
85bce0fa0d
commit
51e36fa158
2 changed files with 7 additions and 1 deletions
|
@ -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();
|
||||
|
|
|
@ -29,6 +29,7 @@ private slots:
|
|||
|
||||
public:
|
||||
Printer(QPrinter *printer, print_options *printOptions, template_options *templateOptions);
|
||||
~Printer();
|
||||
void print();
|
||||
|
||||
signals:
|
||||
|
|
Loading…
Reference in a new issue