Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QT webkit Access Violation Could not initialize egl display: error 12289 when invoked in service or IIS on one website
Forum Updated to NodeBB v4.3 + New Features

QT webkit Access Violation Could not initialize egl display: error 12289 when invoked in service or IIS on one website

Scheduled Pinned Locked Moved Qt WebKit
5 Posts 2 Posters 5.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gzhangx
    wrote on last edited by
    #1

    I build a console app with QT 5.1, msvc 64 bit, console app. It is invoked from asp.net website or a windows service (running as admin) on windows 8 64 bit version.

    EDIT: checking the source, the error 12289 is EGL_NOT_INITIALIZED, looks like the display render initialization failed. Anyone got any quick pointers?

    All it does is load up some webpage, and it works fine on all webpages except one.
    http://search.sunbiz.org/

    On that page it exits with -1073741819 (access violation) and stderr has this:
    class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(void): Could not initialize egl display: error 12289

    It runs fine when I run it in console. when it is invoked via IIS or service, it runs fine on all other websites except the one mentioned above.

    Code is attached:
    Header

    @#ifndef HEADER1_H
    #define HEADER1_H

    #include <QtWebKit>
    #include <QtCore>
    #include <QWebPage>
    #include <QAtomicInt>
    #include <QAuthenticator>
    #include <QFile>
    #include <QFileInfo>
    #include <QNetworkAccessManager>
    #include <QNetworkCookieJar>
    #include <QNetworkReply>
    #include <QWebFrame>
    #include <QProxyStyle>
    #include <QApplication>

    class DManager: public QObject {
    Q_OBJECT
    private:
    QNetworkAccessManager networkAccessManager;
    public:
    DManager();
    QWebPage webPage;
    public slots:
    void load();
    void loadProgress(int progress);

    void warning(const QString & str);
    void error(const QString & str);
    void loadFinished(bool ok);
    

    };

    class MyProxyStyle : public QProxyStyle
    {
    public:
    int styleHint(StyleHint hint, const QStyleOption *option = 0,
    const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const
    {
    if (hint == QStyle::SH_UnderlineShortcut)
    return 0;
    return QProxyStyle::styleHint(hint, option, widget, returnData);
    }
    };

    #endif // HEADER1_H
    @

    Body:
    @#include <QApplication>
    #include <QProxyStyle>
    #include <QPrintEngine>
    #include <QLocalSocket>
    #include "header.h"

    DManager::DManager() :networkAccessManager(this)
    {
    connect(&webPage, SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int)));
    connect(&webPage, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));

    webPage.setNetworkAccessManager(&networkAccessManager);
    

    }

    void DManager::load(){
    QNetworkRequest r = QNetworkRequest(QString("http://search.sunbiz.org/"));
    webPage.mainFrame()->load(r);

    }

    void DManager::loadFinished(bool ok) {
    qApp->exit(0);
    }

    void DManager::loadProgress(int p) {
    printf("load prog %i\n", p);
    FILE * fp = fopen("c:\temp\fopen.txt","a");
    fprintf(fp,"load prog %i\n",p);
    fclose(fp);
    }

    void DManager::warning(const QString & str) {
    FILE * fp = fopen("c:\temp\fopen.txt","a");
    fprintf(fp,"error %s", (const char*)str.toLatin1()) ;
    fclose(fp);
    }

    void DManager::error(const QString & str) {
    FILE * fp = fopen("c:\temp\fopen.txt","a");
    fprintf(fp,"error %s", (const char*)str.toLatin1()) ;
    fclose(fp);
    }

    int main(int argc, char *argv[])
    {
    FILE * fp = fopen("c:\temp\fopen.txt","w");
    fprintf(fp, "start v0.6\n");
    fclose(fp);
    QApplication a(argc, argv);
    a.setStyle(new MyProxyStyle());

    DManager *res = new DManager();
    printf("loading\n");
    res->load();
    int result = a.exec&#40;&#41;;    
    return result;
    

    }
    @

    Project:
    @
    QT += core network webkit webkitwidgets concurrent

    QT += gui

    TARGET = test
    CONFIG += console
    CONFIG -= app_bundle

    TEMPLATE = app

    SOURCES += main.cpp

    HEADERS += header.h
    @

    Code (in c#) to invoke the app (must run under iis or service)
    @
    var name = @"c:\temp\qtweb\release\test.exe";
    var proc = Process.Start(new ProcessStartInfo(name)
    {
    UseShellExecute = false,
    WindowStyle = ProcessWindowStyle.Hidden,
    RedirectStandardError = true,
    RedirectStandardOutput = true,
    CreateNoWindow = true,
    });
    var stdout = proc.StandardOutput.ReadToEndAsync();
    var stderr = proc.StandardError.ReadToEndAsync().Result;

                bool ext = proc.WaitForExit(30000);
                File.WriteAllText(@"c:\temp\test.txt", stderr + "\r\n stdout=" + stdout.Result + "\r\n" + proc.ExitCode + "\r\n"+ext);
    

    @

    Other steps:

    The website/service are running as admin account. I copied all dlls under [QT]\Qt5.1.0\5.1.0\msvc2012_64\bin
    to the app directory, and copied everything under [QT]\Qt5.1.0\5.1.0\msvc2012_64\plugins\platforms to platforms in app directory (structure:

    app
    dlls
    platforms/xxx)

    By default all output went to c:\temp folder.
    Please help.
    Thanks
    GZ

    1 Reply Last reply
    0
    • T Offline
      T Offline
      ThatDude
      wrote on last edited by
      #2

      You say that's console app yet you include
      QtWebKit
      QWebFrame
      QApplication instead of QCoreApplication

      That doesn't look like console application to me
      any of these could attempt to create a widget that will lead to... oh actually it is Webkit complaining: "QT webkit Access Violation"
      so either use networkAccessManager only and forget about WebKit
      or make it a GUI application.

      You can not create GUI components aka widgets in a windowless aka console application - you have to provide graphical interface somehow:
      on linux you could do this "how to use Qt webkit in command line interface":http://qt-project.org/forums/viewthread/29671/

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gzhangx
        wrote on last edited by
        #3

        It works on all other cases, except the one website. So all my methods are fine (it is a windows app with a console). I am trying to build libglesv2 and debug it, running into many issues right now and will post back if I find anything.

        1 Reply Last reply
        0
        • T Offline
          T Offline
          ThatDude
          wrote on last edited by
          #4

          Well your other option is:
          "Qt-5-on-Windows-ANGLE-and-OpenGL":http://qt-project.org/wiki/Qt-5-on-Windows-ANGLE-and-OpenGL

          ..and read carefully deployment section(s)

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gzhangx
            wrote on last edited by
            #5

            I compiled with that this morning and the same thing. I am going to try to force software on d3d.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved