Commit a67e1394 authored by dt's avatar dt
Browse files

Fix memory leak in welcome plugin and right hand side pane

parent 655b06b4
......@@ -220,7 +220,7 @@ void CentralWidget::setSource(const QUrl &url)
qobject_cast<HelpViewer*>(tabWidget->widget(lastTabPage));
if (!viewer && !lastViewer) {
viewer = new HelpViewer(helpEngine, this);
viewer = new HelpViewer(helpEngine, this, this);
viewer->installEventFilter(this);
lastTabPage = tabWidget->addTab(viewer, QString());
tabWidget->setCurrentIndex(lastTabPage);
......@@ -428,7 +428,7 @@ void CentralWidget::setGlobalActions(const QList<QAction*> &actions)
void CentralWidget::setSourceInNewTab(const QUrl &url, int zoom)
{
HelpViewer* viewer = new HelpViewer(helpEngine, this);
HelpViewer* viewer = new HelpViewer(helpEngine, this, this);
viewer->installEventFilter(this);
viewer->setZoom(zoom);
viewer->setSource(url);
......@@ -448,7 +448,7 @@ void CentralWidget::setSourceInNewTab(const QUrl &url, int zoom)
HelpViewer *CentralWidget::newEmptyTab()
{
HelpViewer* viewer = new HelpViewer(helpEngine, this);
HelpViewer* viewer = new HelpViewer(helpEngine, this, this);
viewer->installEventFilter(this);
viewer->setFocus(Qt::OtherFocusReason);
#if defined(QT_NO_WEBKIT)
......
......@@ -491,7 +491,7 @@ void HelpPlugin::createRightPaneSideBar()
addAutoReleasedObject(new Core::BaseRightPaneWidget(m_rightPaneSideBar));
rightPaneLayout->addWidget(w);
m_helpViewerForSideBar = new HelpViewer(m_helpEngine, 0);
m_helpViewerForSideBar = new HelpViewer(m_helpEngine, 0, m_rightPaneSideBar);
Aggregation::Aggregate *agg = new Aggregation::Aggregate();
agg->add(m_helpViewerForSideBar);
agg->add(new HelpViewerFindSupport(m_helpViewerForSideBar));
......
......@@ -207,6 +207,7 @@ ProjectExplorerPlugin::ProjectExplorerPlugin()
ProjectExplorerPlugin::~ProjectExplorerPlugin()
{
removeObject(d->m_welcomePlugin);
delete d->m_welcomePlugin;
removeObject(this);
delete d;
}
......
......@@ -39,6 +39,11 @@ ProjectWelcomePage::ProjectWelcomePage()
}
ProjectWelcomePage::~ProjectWelcomePage()
{
}
QWidget* ProjectWelcomePage::page()
{
return m_page;
......
......@@ -42,6 +42,7 @@ class ProjectWelcomePage : public Utils::IWelcomePage
Q_OBJECT
public:
ProjectWelcomePage();
~ProjectWelcomePage();
QWidget *page();
QString title() const { return tr("Develop"); }
......
......@@ -230,14 +230,14 @@ bool HelpPage::acceptNavigationRequest(QWebFrame *,
return false;
}
HelpViewer::HelpViewer(QHelpEngine *engine, Help::Internal::CentralWidget *parent)
HelpViewer::HelpViewer(QHelpEngine *engine, Help::Internal::CentralWidget *central, QWidget *parent)
: QWebView(parent)
, helpEngine(engine)
, parentWidget(parent)
, parentWidget(central)
, multiTabsAllowed(true)
, loadFinished(false)
{
setPage(new HelpPage(parent, helpEngine, this));
setPage(new HelpPage(central, helpEngine, this));
settings()->setAttribute(QWebSettings::PluginsEnabled, false);
settings()->setAttribute(QWebSettings::JavaEnabled, false);
......@@ -245,7 +245,7 @@ HelpViewer::HelpViewer(QHelpEngine *engine, Help::Internal::CentralWidget *paren
QAction* action = pageAction(QWebPage::OpenLinkInNewWindow);
action->setText(tr("Open Link in New Tab"));
if (!parent) {
if (!central) {
multiTabsAllowed = false;
action->setVisible(false);
}
......
......@@ -64,7 +64,7 @@ class HelpViewer : public QWebView
Q_OBJECT
public:
HelpViewer(QHelpEngine *helpEngine, Help::Internal::CentralWidget *parent);
HelpViewer(QHelpEngine *helpEngine, Help::Internal::CentralWidget *central, QWidget *parent);
void setSource(const QUrl &url);
inline QUrl source() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment