I'm writting some kind of web-browser based on QTWebEngine. So I have a crash when trying to run it. Here is my code (you may try to build it):

main.cpp:

Qt Code:
  1. #include <QtWidgets>
  2. #include "mainwindow.h"
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. QApplication a(argc, argv);
  7.  
  8. MainWindow * mainWnd = new MainWindow();
  9. mainWnd -> show();
  10.  
  11. return a.exec();
  12. }
To copy to clipboard, switch view to plain text mode 

mainwindow.h:
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5. #include <QMenuBar>
  6. #include <QMenu>
  7. #include <QPushButton>
  8. #include <QLineEdit>
  9. #include <QComboBox>
  10. #include <QLayout>
  11. #include <QHBoxLayout>
  12. #include <qtwebenginewidgetsglobal.h>
  13. #include <QWebEngineView>
  14.  
  15. class MainWindow : public QWidget
  16. {
  17. Q_OBJECT
  18. public:
  19. explicit MainWindow(QWidget *parent = 0);
  20. ~MainWindow();
  21.  
  22. private:
  23. void createMenu();
  24. void createUrlBar();
  25. void createBrowserWindow();
  26.  
  27. void loadHomepage();
  28. void loadUrl (QUrl);
  29.  
  30. void applyLayouts();
  31.  
  32. QMenuBar * menuBar;
  33. QMenu * menuFile, * menuFile2;
  34.  
  35. QWidget * barWidget;
  36. QPushButton * barNextBut,* barBackBut, * barRefreshBut, * barEnterBut;
  37. QLineEdit * barUrlEdit;
  38. QComboBox * barSelectCB;
  39.  
  40. QWebEngineView * browserWidget;
  41.  
  42. QHBoxLayout * barLayout;
  43. QVBoxLayout * mainLayout;
  44.  
  45. signals:
  46.  
  47. public slots:
  48. };
  49.  
  50. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 


mainwindow.cpp:

Qt Code:
  1. #include "mainwindow.h"
  2.  
  3. MainWindow::MainWindow(QWidget * parent)
  4. {
  5.  
  6. this -> setMinimumSize (1100, 600);
  7.  
  8. createMenu();
  9. createUrlBar();
  10. createBrowserWindow();
  11.  
  12. applyLayouts();
  13.  
  14. loadHomepage();
  15.  
  16. }
  17.  
  18. void MainWindow::createMenu()
  19. {
  20.  
  21. menuBar = new QMenuBar();
  22. menuFile = new QMenu("File");
  23. menuFile2 = new QMenu("File2");
  24. menuFile -> addMenu (menuFile2);
  25. menuBar -> addMenu (menuFile);
  26.  
  27. }
  28.  
  29. void MainWindow::createUrlBar()
  30. {
  31.  
  32. //Контейнер;
  33. barWidget = new QWidget(this);
  34. barWidget -> setContextMenuPolicy(Qt::NoContextMenu);
  35. barWidget -> setMaximumHeight(30);
  36.  
  37. //Кнопки;
  38. barNextBut = new QPushButton(">");
  39. barBackBut = new QPushButton("<");
  40. barRefreshBut = new QPushButton("R");
  41. barEnterBut = new QPushButton("->");
  42. barNextBut -> setMaximumSize(21, 21);
  43. barBackBut -> setMaximumSize(21, 21);
  44. barRefreshBut -> setMaximumSize(21, 21);
  45. barEnterBut -> setMaximumSize(21, 21);
  46.  
  47. barUrlEdit = new QLineEdit(barWidget);
  48. barUrlEdit -> setMinimumSize(256, 21);
  49. barUrlEdit -> setMaximumHeight(21);
  50.  
  51. barSelectCB = new QComboBox(barWidget);
  52. barSelectCB -> setMinimumSize(256, 21);
  53. barSelectCB -> setMaximumSize(256, 21);
  54.  
  55. }
  56.  
  57. void MainWindow::createBrowserWindow()
  58. {
  59.  
  60. browserWidget = new QWebEngineView(this);
  61.  
  62. }
  63.  
  64. void MainWindow::loadHomepage()
  65. {
  66.  
  67. QUrl * url = new QUrl("http://google.ru");
  68. loadUrl(*url);
  69. delete(url);
  70.  
  71. }
  72.  
  73. void MainWindow::loadUrl (QUrl url)
  74. {
  75.  
  76. browserWidget -> load(url);
  77.  
  78. }
  79.  
  80. void MainWindow::applyLayouts ()
  81. {
  82.  
  83. barLayout = new QHBoxLayout();
  84. barLayout -> setContentsMargins(0,0,0,0);
  85. barLayout -> addWidget(barSelectCB);
  86. barLayout -> addWidget(barBackBut);
  87. barLayout -> addWidget(barNextBut);
  88. barLayout -> addWidget(barUrlEdit);
  89. barLayout -> addWidget(barRefreshBut);
  90. barLayout -> addWidget(barEnterBut);
  91. barWidget -> setLayout(barLayout);
  92.  
  93. mainLayout = new QVBoxLayout();
  94. mainLayout -> setDirection(QBoxLayout::TopToBottom);
  95. mainLayout -> setMenuBar(menuBar);
  96. mainLayout -> addWidget (barWidget);
  97. mainLayout -> addWidget (browserWidget);
  98. setLayout(mainLayout);
  99.  
  100. }
To copy to clipboard, switch view to plain text mode 

And project.pro file:

Qt Code:
  1. QT += widgets
  2. QT += webenginewidgets
  3.  
  4. HEADERS = mainwindow.h
  5. SOURCES = main.cpp \
  6. mainwindow.cpp
To copy to clipboard, switch view to plain text mode 


It builds without errors and warnings, but works pretty bad. Sometimes it crashes at QApplication.exec(), sometimes in other places and always crashes after exit. Can you try to build my code and say me, what i'm doing wrong? I also have a backtrace (dont know how to use spoilers here, sorry):

Qt Code:
  1. [0726/170125:FATAL:resource_scheduler.cc(1051)] Check failed: client_map_.empty().
  2. Backtrace:
  3. GetHandleVerifier [0x000000018277DF66+28758]
  4. QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001826DEA59+2499705]
  5. QtWebEngineCore::JavaScriptDialogController::qt_static_metacall [0x0000000180BFA4CE+10049518]
  6. QtWebEngineCore::JavaScriptDialogController::qt_static_metacall [0x000000018099B79C+7563964]
  7. QtWebEngineCore::JavaScriptDialogController::qt_static_metacall [0x000000018099B29E+7562686]
  8. QtWebEngineCore::JavaScriptDialogController::qt_static_metacall [0x00000001809B93D7+7685879]
  9. QtWebEngineCore::JavaScriptDialogController::qt_static_metacall [0x00000001809B91F5+7685397]
  10. QtWebEngineCore::JavaScriptDialogController::qt_static_metacall [0x00000001809A77B6+7613142]
  11. QtWebEngineCore::JavaScriptDialogController::qt_static_metacall [0x000000018026BB01+28193]
  12. QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x000000018258F67A+1126554]
  13. CertificateErrorController::error [0x00000001814ED607+5469703]
  14. QtWebEngineCore::WebContentsAdapter::d_func [0x000000018021A9BD+100701]
  15. GetHandleVerifier [0x0000000182817AFC+658412]
  16. QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182719709+2740521]
  17. QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182717331+2731345]
  18. QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x00000001827179D4+2733044]
  19. GetHandleVerifier [0x000000018281B81C+674060]
  20. GetHandleVerifier [0x000000018281D6D0+681920]
  21. GetHandleVerifier [0x000000018281D625+681749]
  22. QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182719331+2739537]
  23. QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x000000018273B3FB+2879003]
  24. QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182719173+2739091]
  25. QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x000000018275EB8D+3024301]
  26. QtWebEngineCore::JavaScriptDialogController::qt_static_metacall [0x00000001808F1846+6867814]
  27. QtWebEngineCore::JavaScriptDialogController::qt_static_metacall [0x00000001808F2C1C+6872892]
  28. QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x000000018275F9CD+3027949]
  29. QtWebEngineCore::URLRequestCustomJobDelegate::qt_static_metacall [0x0000000182768D45+3065701]
  30. BaseThreadInitThunk [0x0000000076C5652D+13]
  31. RtlUserThreadStart [0x0000000076E8C541+33]
To copy to clipboard, switch view to plain text mode