Skip to content

Commit

Permalink
mythuiwebbrowser: only create the browser window if the parent is not…
Browse files Browse the repository at this point in the history
… the GlobalObjectStore

This fixes a bug when using Qt5.14 where an empty browser window sometimes
appears over the GUI. Fixes #13544
  • Loading branch information
paul-h committed Feb 11, 2020
1 parent 6d43d66 commit 67ab1a7
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion mythtv/libs/libmythui/mythuiwebbrowser.cpp
Expand Up @@ -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;

Expand Down Expand Up @@ -1127,6 +1131,9 @@ void MythUIWebBrowser::SetBackgroundColor(QColor color)
*/
void MythUIWebBrowser::SetActive(bool active)
{
if (!m_browser)
return;

if (m_active == active)
return;

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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)
{
Expand All @@ -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()))
Expand All @@ -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())
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 67ab1a7

Please sign in to comment.