CefView / QCefView

A Qt Widget encapsulated CEF view based on QWidget
https://cefview.github.io/QCefView/
GNU Lesser General Public License v2.1
502 stars 133 forks source link

[BUG]: 在windows11 64bit, Qt5.15.2 + MSVC2022 64bit环境下崩溃 #381

Open xiechongzhu opened 4 months ago

xiechongzhu commented 4 months ago

操作系统:win11 64位企业版 Qt版本:5.15.2 MSVC 64位 VS版本:2022企业版64位

按照帮助文档里的方法写了一个demo,在程序启动的时候报错: [0305/222822.360:WARNING:chrome_browser_cloud_management_controller.cc(87)] Could not create policy manager as CBCM is not enabled. [0305/222822.360:WARNING:chrome_browser_cloud_management_controller.cc(87)] Could not create policy manager as CBCM is not enabled.

DevTools listening on ws://127.0.0.1:9000/devtools/browser/b00a81f8-8e1a-4485-bf0b-048b67cb8fb8 CCefAppDelegate is being destructed [0305/222822.403:FATAL:request_context_impl.cc(97)] Check failed: false. context not valid [0305/222822.403:FATAL:request_context_impl.cc(97)] Check failed: false. context not valid

程序代码:

int main(int argc, char *argv[])
{
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QApplication a(argc, argv);
    QCefConfig config;
    config.setUserAgent("QCefViewTest");
    config.setLogLevel(QCefConfig::LOGSEVERITY_DEFAULT);
    config.setBridgeObjectName("CallBridge");
    config.setRemoteDebuggingPort(9000);
    config.setBackgroundColor(Qt::lightGray);

    // add command line args
    // config.addCommandLineSwitch("allow-universal-access-from-files");
    config.addCommandLineSwitch("enable-media-stream");
    config.addCommandLineSwitch("use-mock-keychain");
    config.addCommandLineSwitch("allow-file-access-from-files");
    config.addCommandLineSwitch("disable-spell-checking");
    config.addCommandLineSwitch("disable-site-isolation-trials");
    config.addCommandLineSwitch("enable-aggressive-domstorage-flushing");
    //config.addCommandLineSwitchWithValue("renderer-process-limit", "1");
    config.addCommandLineSwitchWithValue("disable-features", "BlinkGenPropertyTrees,TranslateUI,site-per-process");
    QCefContext(&a, argc, argv, &config);
    MainWindow w;
    w.show();
    return a.exec();
}

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QString htmlFile = qApp->applicationDirPath() + "/../../index.html";
    ui->widget->navigateToUrl(htmlFile);
}
L-Super commented 4 months ago

Based on the limited information provided,you can try to search for information about CBCM, this should be related to CEF

be-water-myFriend commented 4 months ago

ui->widget初始化有问题,你按example里面的方式试试