[solved] App crashes direct after start, when using MSVC2012 (Visual Studio 2013) 32bit and 64bit



  • Hi,
    i moved from MinGW to MSVC compiler.

    Everything compiles without warning.
    But when starting direct after creating QApplication in main the app crashes with the error (see screenshot):

    @ASSERT failure in QGuiApplication::font(): "no QGuiApplication instance", fike kernel\qguiapplication.cpp, line 2764@

    But my main creates the QApplication or QGuiApplication direct at the beginning.
    I tryied with creating QApplication on the heap and on the stack, both times same crash...

    "See ASSERTION screenshot...":https://www.dropbox.com/s/1mdrhip1z2iq53x/qt-error.png?dl=0

    I link against a static lib (my own) which uses QFont..
    Maybe there is a ordering problem... ?

    Greetings
    Nando


  • Moderators

    Do you create anything before the QApplication? Do you have any static or global QObjects? Can you show your main() code?



  • Hi,
    i commented out a lot to find the problem.
    My main :

    @int main(int argc, char **argv)
    {
    QGuiApplication application(argc, argv);

    return application.exec();
    

    @

    Really nothing in there now.. BUT i statically link against a library which internally uses QFont members in some classes (but not used / called in this test).

    [quote author="Chris Kawa" date="1419703374"]Do you create anything before the QApplication? Do you have any static or global QObjects? Can you show your main() code?[/quote]


  • Moderators

    bq. BUT i statically link against a library which internally uses QFont members in some classes.

    Maybe IT creates some statics or globals. If you can't inspect or modify that library consider linking to it dynamically, after QApplication has been created.



  • the lib against i link is also from me.

    And the lib has one class which hass some QFont members with getters and setters. No static or globals there. But another class inside the lib is singleton so this class has a static but no qt gui stuff usage.

    [quote author="Chris Kawa" date="1419704089"]bq. BUT i statically link against a library which internally uses QFont members in some classes.

    Maybe IT creates some statics or globals. If you can't inspect or modify that library consider linking to it dynamically, after QApplication has been created.[/quote]


  • Moderators

    bq. but no qt gui stuff usage

    Doesn't have to be gui stuff. QObject or a call to some of the Qt static functions is enough to make this not work.



  • I do not why, but when building it with MSVC 2013 OpenGL 32 bit it works.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.