Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-83736

Registering a QQuickItem keeps QML app from crashing when calling QFont default constructor

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Out of scope
    • Affects Version/s: 5.6
    • Fix Version/s: None
    • Component/s: QML: Compiler
    • Labels:
      None
    • Environment:
      ARM, Windows Embedded Compact 2013, Qt 5.6,
    • Platform/s:
      Windows

      Description

      First of all: this is Qt 5.6 on WEC2013, with is a deprecated and unsupported OS. I do not know that I cannot post questions on unsupported platforms. If that is the case, please ignore this question as quickly as possible.

      But this is nuts:

      • I isolated a code change that precipitates a fatal exit
      • I found that I can keep the code change if I register a QQuickItem

      This is a Qt 5.6 project which is statically linked into an MSVC project using using the VS2012 ARM compiler for WinCE (Windows Embedded Compact 2013). There are no later versions of Qt for the target platform.

      The code that fails: 

        QGuiApplication app(argc, &argv);
        QFont defaultFont; // <- causes crash 30s after should have shown UI
      

       

      Instantiating the QFont object causes my app to exit 30 seconds after the UI should be visible with the following fatal error:

      qplatformfunctions_wince.h(290) : GetGlyphOutline() not supported under Windows CE. Please try using freetype font-rendering, by passing the command line argument -platform windows:fontengine=freetype to the application.

      Passing -platform windows:fontengine=freetype to QGuiApplication changed nothing. This is how I pass the arguments to QGuiApplication:

        int argc = 2;
        char *argv[] = {
            const_cast<char*>("-platform"),
            const_cast<char*>("windows:fontengine=freetype")
        };
        QGuiApplication app(argc, argv);
        QFont defaultFont; 
      

       

      The following code solves the problem:

        qmlRegisterType<QQuickItem>("MyModule", 1, 0, "register_MyModule");

      This is the only QQuickItem my code registers.

      The reason why I'm instantiating a QFont object is to get the default system font's family. Calling QGuiApplication::font() to get it fails the same way.

      My app is large and I cannot test it on Windows desktop. I am unable to reproduce the issue with a minimal ARM app and suspect this has to do with font rendering on WinCE; if it is then it would not affect other platforms.

      The QFont declaration after QGuiApplication should not cause a problem. Does anyone know why registering a QQuickItem would prevent the fatal error?

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            stan.m Stanley Morris
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes