summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/api/qwebenginepage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webenginewidgets/api/qwebenginepage.cpp')
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index a1ddf88d7..696b6723f 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -177,6 +177,8 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
ensureInitialized();
wasShown();
});
+
+ profile->d_ptr->addWebContentsAdapterClient(this);
}
QWebEnginePagePrivate::~QWebEnginePagePrivate()
@@ -185,6 +187,7 @@ QWebEnginePagePrivate::~QWebEnginePagePrivate()
profile->d_ptr->profileAdapter()->removePageRequestInterceptor();
delete history;
delete settings;
+ profile->d_ptr->removeWebContentsAdapterClient(this);
}
RenderWidgetHostViewQtDelegate *QWebEnginePagePrivate::CreateRenderWidgetHostViewQtDelegate(RenderWidgetHostViewQtDelegateClient *client)
@@ -255,7 +258,7 @@ void QWebEnginePagePrivate::didUpdateTargetURL(const QUrl &hoveredUrl)
void QWebEnginePagePrivate::selectionChanged()
{
Q_Q(QWebEnginePage);
- Q_EMIT q->selectionChanged();
+ QTimer::singleShot(0, q, &QWebEnginePage::selectionChanged);
}
void QWebEnginePagePrivate::recentlyAudibleChanged(bool recentlyAudible)
@@ -479,6 +482,13 @@ void QWebEnginePagePrivate::authenticationRequired(QSharedPointer<Authentication
controller->accept(networkAuth.user(), networkAuth.password());
}
+void QWebEnginePagePrivate::releaseProfile()
+{
+ qDebug("Release of profile requested but WebEnginePage still not deleted. Expect troubles !");
+ // this is not the way to go, but might avoid the crash if user code does not make any calls to page.
+ delete q_ptr->d_ptr.take();
+}
+
void QWebEnginePagePrivate::showColorDialog(QSharedPointer<ColorChooserController> controller)
{
#if QT_CONFIG(colordialog)
@@ -845,7 +855,7 @@ QWebEnginePage::QWebEnginePage(QObject* parent)
\property QWebEnginePage::contentsSize
\since 5.7
- The size of the page contents.
+ \brief The size of the page contents.
*/
/*!
@@ -907,11 +917,13 @@ QWebEnginePage::QWebEnginePage(QWebEngineProfile *profile, QObject* parent)
QWebEnginePage::~QWebEnginePage()
{
- Q_D(QWebEnginePage);
- setDevToolsPage(nullptr);
- d->adapter->stopFinding();
- QWebEnginePagePrivate::bindPageAndView(this, nullptr);
- QWebEnginePagePrivate::bindPageAndWidget(this, nullptr);
+ if (d_ptr) {
+ // d_ptr might be exceptionally null if profile adapter got deleted first
+ setDevToolsPage(nullptr);
+ d_ptr->adapter->stopFinding();
+ QWebEnginePagePrivate::bindPageAndView(this, nullptr);
+ QWebEnginePagePrivate::bindPageAndWidget(this, nullptr);
+ }
}
QWebEngineHistory *QWebEnginePage::history() const
@@ -994,7 +1006,7 @@ void QWebEnginePage::setWebChannel(QWebChannel *channel, uint worldId)
/*!
\property QWebEnginePage::backgroundColor
- \brief the page's background color behind the document's body.
+ \brief The page's background color behind the document's body.
\since 5.6
You can set the background color to Qt::transparent or to a translucent
@@ -1045,7 +1057,7 @@ void QWebEnginePage::save(const QString &filePath,
/*!
\property QWebEnginePage::audioMuted
- \brief whether the current page audio is muted.
+ \brief Whether the current page audio is muted.
\since 5.7
The default value is \c false.
@@ -1067,7 +1079,7 @@ void QWebEnginePage::setAudioMuted(bool muted) {
/*!
\property QWebEnginePage::recentlyAudible
- \brief the current page's \e {audible state}, that is, whether audio was recently played
+ \brief The current page's \e {audible state}, that is, whether audio was recently played
or not.
\since 5.7
@@ -2022,7 +2034,7 @@ QUrl QWebEnginePage::requestedUrl() const
/*!
\property QWebEnginePage::iconUrl
- \brief the URL of the icon associated with the page currently viewed
+ \brief The URL of the icon associated with the page currently viewed.
By default, this property contains an empty URL.
@@ -2036,7 +2048,7 @@ QUrl QWebEnginePage::iconUrl() const
/*!
\property QWebEnginePage::icon
- \brief the icon associated with the page currently viewed
+ \brief The icon associated with the page currently viewed.
\since 5.7
By default, this property contains a null icon. If the web page specifies more than one icon,