Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Application / QApplication problems with Valgrind



  • I get the following problem with Application / QApplication when running Valgrind in Qt Creator:

    Conditional jump or move depends on uninitialised value(s)
      in Application in /home/daniel/Documents/Qt/ElectimaxWin/main.h:7
      1: /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.30
      2: /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.2
      3: g_signal_emit_valist in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.2
      4: g_signal_emit_by_name in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.2
      5: g_object_set_valist in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.2
      6: g_object_set in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.2
      7: /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.5.1
      8: QStyleFactory::create(QString const&) in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.5.1
      9: QApplication::style() in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.5.1
      10: QApplicationPrivate::initialize() in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.5.1
      11: QApplicationPrivate::construct() in /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5.5.1
      12: Application in /home/daniel/Documents/Qt/ElectimaxWin/main.h:7
      13: main in /home/daniel/Documents/Qt/ElectimaxWin/main.cpp:47
    Uninitialised value was created by a stack allocation  1: g_cclosure_marshal_VOID__VOIDv in /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0.4800.2
    

    Here is my main program:

    #include <QApplication>
    #include <QMessageBox>
    #include <typeinfo>
    #include "main.h"
    #include "mainwindow.h"
    
    bool Application::notify(QObject* receiver, QEvent* event)
    {
        try
        {
            return QApplication::notify(receiver, event);
        }
        catch (std::exception &e)
        {
            qFatal("Error %s sending event %s to object %s (%s)",
                e.what(), typeid(*event).name(), qPrintable(receiver->objectName()), typeid(*receiver).name());
        }
        catch (...)
        {
            qFatal("Error <unknown> sending event %s to object %s (%s)",
                typeid(*event).name(), qPrintable(receiver->objectName()), typeid(*receiver).name());
        }
        return false;
    }
    
    int main(int argc, char *argv[])
    {
        Application a(argc, argv);
        MainWindow w;
        w.show();
        return a.exec();
    }
    

    And main.h:

    #include <QApplication>
    
    class Application final : public QApplication
    {
        Q_OBJECT
    public:
        using QApplication::QApplication;
        virtual bool notify(QObject *receiver, QEvent *e) override;
    };
    
    

  • Qt Champions 2019

    As you can see it's somewhere deep inside libgobject/libgtk - don't think Qt can do anything against it here. I would simply ignore it.



  • Thanks for the tip!



  • This post is deleted!

Log in to reply