diff --git a/mythtv/libs/libmythui/mythuiwebbrowser.cpp b/mythtv/libs/libmythui/mythuiwebbrowser.cpp index 34b448adfe8..34e299dc7c4 100644 --- a/mythtv/libs/libmythui/mythuiwebbrowser.cpp +++ b/mythtv/libs/libmythui/mythuiwebbrowser.cpp @@ -872,6 +872,10 @@ void MythUIWebBrowser::Finalize(void) */ void MythUIWebBrowser::Init(void) { + // only do the initialisation for widgets not being stored in the global object store + if (parent() == GetGlobalObjectStore()) + return; + if (m_initialized) return; @@ -1127,6 +1131,9 @@ void MythUIWebBrowser::SetBackgroundColor(QColor color) */ void MythUIWebBrowser::SetActive(bool active) { + if (!m_browser) + return; + if (m_active == active) return; @@ -1325,6 +1332,9 @@ QVariant MythUIWebBrowser::evaluateJavaScript(const QString &scriptSource) void MythUIWebBrowser::Scroll(int dx, int dy) { + if (!m_browser) + return; + QPoint startPos = m_browser->page()->currentFrame()->scrollPosition(); QPoint endPos = startPos + QPoint(dx, dy); @@ -1434,6 +1444,9 @@ bool MythUIWebBrowser::IsOnTopScreen(void) void MythUIWebBrowser::UpdateScrollBars(void) { + if (!m_browser) + return; + QPoint position = m_browser->page()->currentFrame()->scrollPosition(); if (m_verticalScrollbar) { @@ -1460,7 +1473,7 @@ void MythUIWebBrowser::UpdateBuffer(void) { UpdateScrollBars(); - if (!m_image) + if (!m_image || !m_browser) return; if (!m_active || (m_active && !m_browser->hasFocus())) @@ -1479,6 +1492,9 @@ void MythUIWebBrowser::UpdateBuffer(void) */ void MythUIWebBrowser::Pulse(void) { + if (!m_browser) + return; + if (m_scrollAnimation.IsActive() && m_destinationScrollPos != m_browser->page()->currentFrame()->scrollPosition()) @@ -1521,6 +1537,9 @@ void MythUIWebBrowser::DrawSelf(MythPainter *p, int xoffset, int yoffset, */ bool MythUIWebBrowser::keyPressEvent(QKeyEvent *event) { + if (!m_browser) + return false; + QStringList actions; bool handled = false; handled = GetMythMainWindow()->TranslateKeyPress("Browser", event, actions);