Avoid a possible crash when raising the Link event.

[GB.QT4]
* BUG: Avoid a possible crash when raising the Link event.

[GB.QT5]
* BUG: Avoid a possible crash when raising the Link event.
This commit is contained in:
gambas 2021-01-11 03:36:28 +01:00
parent 1d270de336
commit 15bba0dfe2
2 changed files with 12 additions and 5 deletions

View File

@ -572,8 +572,12 @@ void CWebView::titleChanged(const QString &title)
void CWebView::linkHovered(const QString &link, const QString &title, const QString &textContent)
{
void *_object = QT.GetObject(((QWebPage*)sender())->view());
set_link(THIS, link);
GB.Raise(THIS, EVENT_LINK, 0);
if (THIS)
{
set_link(THIS, link);
GB.Raise(THIS, EVENT_LINK, 0);
}
}
/*void CWebView::frameCreated(QWebFrame *frame)

View File

@ -406,7 +406,7 @@ END_PROPERTY
BEGIN_METHOD_VOID(WebView_Clear)
delete WIDGET->page();
//delete WIDGET->page();
WIDGET->setPage(new MyWebPage(WIDGET));
QObject::connect(WIDGET->page(), SIGNAL(linkHovered(const QString &)), &WebViewSignalManager::manager, SLOT(linkHovered(const QString &)));
@ -962,8 +962,11 @@ void WebViewSignalManager::linkHovered(const QString &link)
{
void *_object = QT.GetObject(((QWebEnginePage*)sender())->view());
set_link(THIS, link);
GB.Raise(THIS, EVENT_LINK, 0);
if (THIS)
{
set_link(THIS, link);
GB.Raise(THIS, EVENT_LINK, 0);
}
}
void WebViewSignalManager::loadStarted()