@@ -120,7 +120,7 @@ void Automation::Init(const BrowserOptions& options, int* build_no, Error** erro
120120
121121 // check found widget if it is QWebView or top level widget
122122 QWebView* pWebView = qobject_cast<QWebView*>(pWidget);
123- if ((pWebView != NULL ))
123+ if ((pWebView != NULL ) && (!pWebView-> isHidden ()) )
124124 {
125125 qDebug ()<<" [WD]:" <<" looking for start window: " <<pWidget<<pWidget->windowTitle ();
126126
@@ -259,14 +259,6 @@ void Automation::Terminate()
259259 {
260260 if (!pView->isHidden ())
261261 {
262- // destroy children correctly
263- QList<QWidget*> childs = pView->findChildren <QWidget*>();
264- foreach (QWidget *child, childs)
265- {
266- child->setAttribute (Qt::WA_DeleteOnClose, true );
267- child->close ();
268- }
269-
270262 pView->setAttribute (Qt::WA_DeleteOnClose, true );
271263 pView->close ();
272264 }
@@ -1045,14 +1037,7 @@ void Automation::CloseView(const WebViewId &view_id, Error **error)
10451037 QWidget *view = view_id.GetView ();
10461038 logger_.Log (kWarningLogLevel , " Automation::CloseView" );
10471039
1048- // destroy children correctly
1049- QList<QWidget*> childs = view->findChildren <QWidget*>();
1050- foreach (QWidget *child, childs)
1051- {
1052- child->setAttribute (Qt::WA_DeleteOnClose, true );
1053- child->close ();
1054- }
1055-
1040+ view->setAttribute (Qt::WA_DeleteOnClose, true );
10561041 view->close ();
10571042}
10581043
0 commit comments