Commit 94d7e147 authored by David Hallas's avatar David Hallas

Fixes leak of DolphinFileMetaDataWidget in ToolTipManager

Summary:
Fixes leak of DolphinFileMetaDataWidget in ToolTipManager. The
destructor of ToolTipManager failed to delete the m_fileMetaDataWidget
member. This is seen at shutdown but also when you close a tab that has
displayed a tooltip.

Test Plan:
Compile Dolphin with address sanitizer
Open Dolphin
Show a tooltip
Close Dolphin

Reviewers: #dolphin, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D19485
parent 9f2bb143
......@@ -82,11 +82,10 @@ void ToolTipManager::showToolTip(const KFileItem& item, const QRectF& itemRect,
// Only start the retrieving of the content, when the mouse has been over this
// item for 200 milliseconds. This prevents a lot of useless preview jobs and
// meta data retrieval, when passing rapidly over a lot of items.
delete m_fileMetaDataWidget;
m_fileMetaDataWidget = new DolphinFileMetaDataWidget();
connect(m_fileMetaDataWidget, &DolphinFileMetaDataWidget::metaDataRequestFinished,
m_fileMetaDataWidget.reset(new DolphinFileMetaDataWidget());
connect(m_fileMetaDataWidget.data(), &DolphinFileMetaDataWidget::metaDataRequestFinished,
this, &ToolTipManager::slotMetaDataRequestFinished);
connect(m_fileMetaDataWidget, &DolphinFileMetaDataWidget::urlActivated,
connect(m_fileMetaDataWidget.data(), &DolphinFileMetaDataWidget::urlActivated,
this, &ToolTipManager::urlActivated);
m_contentRetrievalTimer->start();
......@@ -209,7 +208,7 @@ void ToolTipManager::showToolTip()
if (!m_tooltipWidget) {
m_tooltipWidget.reset(new KToolTipWidget());
}
m_tooltipWidget->showBelow(m_itemRect, m_fileMetaDataWidget, m_transientParent);
m_tooltipWidget->showBelow(m_itemRect, m_fileMetaDataWidget.data(), m_transientParent);
m_toolTipRequested = false;
}
......@@ -84,7 +84,7 @@ private:
/// Transient parent of the tooltip, mandatory on Wayland.
QWindow* m_transientParent;
DolphinFileMetaDataWidget* m_fileMetaDataWidget;
QScopedPointer<DolphinFileMetaDataWidget> m_fileMetaDataWidget;
QScopedPointer<KToolTipWidget> m_tooltipWidget;
bool m_toolTipRequested;
......
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