mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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;
|
this->templateOptions = templateOptions;
|
||||||
dpi = 0;
|
dpi = 0;
|
||||||
done = 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)
|
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()
|
void Printer::print()
|
||||||
{
|
{
|
||||||
TemplateLayout t(printOptions, templateOptions);
|
TemplateLayout t(printOptions, templateOptions);
|
||||||
webView = new QWebView();
|
|
||||||
connect(&t, SIGNAL(progressUpdated(int)), this, SLOT(templateProgessUpdated(int)));
|
connect(&t, SIGNAL(progressUpdated(int)), this, SLOT(templateProgessUpdated(int)));
|
||||||
|
|
||||||
dpi = printer->resolution();
|
dpi = printer->resolution();
|
||||||
|
|
|
@ -29,6 +29,7 @@ private slots:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Printer(QPrinter *printer, print_options *printOptions, template_options *templateOptions);
|
Printer(QPrinter *printer, print_options *printOptions, template_options *templateOptions);
|
||||||
|
~Printer();
|
||||||
void print();
|
void print();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
Loading…
Add table
Reference in a new issue