Skip to content

Commit

Permalink
fix: [extension] cause app cannot exit
Browse files Browse the repository at this point in the history
webview could not quit normally, cause
app cannot exit.
Log: bug fix

Change-Id: Ifd4124da0506d4387835a1dcced2e0d2c9a0761f
  • Loading branch information
deepin-mozart authored and deepin-ci-robot committed Feb 21, 2024
1 parent ee66a8e commit d5e8c7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/plugins/core/gui/plugindetailsview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ DetailsView::DetailsView(QWidget *parent)
setupUi();
}

DetailsView::~DetailsView()
{
if (webView) {
webView->stop();
// delete webView will cause app cannot exit.
webView->setParent(nullptr);
}
}

void DetailsView::update(const dpf::PluginMetaObjectPointer &metaInfo)
{
pluginMetaInfo = metaInfo;
Expand Down Expand Up @@ -94,7 +103,7 @@ void DetailsView::setupUi()
logoLabel->setPixmap(QIcon::fromTheme("plugins-navigation").pixmap(QSize(128, 128)));

auto webViewLayout = new QHBoxLayout(this);
QWebEngineView *webView = new QWebEngineView(this);
webView = new QWebEngineView();
// TODO(mozart): load from local.
// webView->load(QUrl::fromLocalFile("url"));
webView->load(QUrl("https://ecology.chinauos.com/adaptidentification/doc_new/#document2?dirid=656d40a9bd766615b0b02e5e"));
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/core/gui/plugindetailsview.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ QT_BEGIN_NAMESPACE
class QGridLayout;
class QVBoxLayout;
class QSpacerItem;
class QWebEngineView;
QT_END_NAMESPACE

DWIDGET_BEGIN_NAMESPACE
Expand Down Expand Up @@ -60,6 +61,7 @@ class DetailsView : public DTK_WIDGET_NAMESPACE::DWidget
};

explicit DetailsView(QWidget *parent = nullptr);
~DetailsView();

void update(const dpf::PluginMetaObjectPointer &metaInfo);

Expand All @@ -73,7 +75,7 @@ private slots:
DTK_WIDGET_NAMESPACE::DLabel *metaInfoLabel {nullptr};
DTK_WIDGET_NAMESPACE::DPushButton *loadBtn {nullptr};
dpf::PluginMetaObjectPointer pluginMetaInfo;

QWebEngineView *webView {nullptr};
};

#endif // PLUGINDETAILSVIEW_H

0 comments on commit d5e8c7e

Please sign in to comment.