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

Error when closing application in Qt4.8 using QDeclarative and QML



  • Hello,

    I am having some trouble when I close my application I get an error. I am defining a new QML element by QDeclarativeItem and sharing a property through Q_PROPERTY. My class looks like this:

    @class PluginName : public QDeclarativeItem
    {
    Q_OBJECT
    Q_PROPERTY (QString pluginName READ m_sGetPluginName WRITE m_vSetPluginName)

    public:
    //PluginPage(QDeclarativeItem* poParent = NULL);
    //~PluginPage();
    void m_vSetPluginName (const QString& sName);
    QString m_sGetPluginName () const;

    private:
    QString m_sPluginName;
    };@

    And in the .cpp:

    @void PluginName::m_vSetPluginName (const QString& sName)
    {
    m_sPluginName = sName;
    }

    QString PluginName::m_sGetPluginName () const
    {
    return m_sPluginName;
    }@

    Also My .qml

    @import QtQuick 1.1
    import Simu 1.0

    Item{
    id: mainWindow
    objectName: "item"
    width:1000
    height:600

    PluginName
    {
    pluginName:"name"
    }

    Rectangle
    {
        id: idMyWindow                   // unique identifier for this button
    

    objectName: "rect"
    color: "blue" // backgrond color
    width: 800 // window size
    height: 600
    x: 10 // x-absolute position from parent <mainWindow>
    y: 20 // y-absolute position from parent <mainWindow>

    }
    

    }@

    I am also using "qmlRegisterType" to register my PluginName class.

    If I don't use my new QML element then I don't get the heap error I wonder what is wrong :(

    This is the error, I am using MSVC 2005:

    "Windows has triggered a breakpoint in _visufrwk_proj.exe.

    This may be due to a corruption of the heap, and indicates a bug in _visufrwk_proj.exe or any of the DLLs it has loaded.

    The output window may have more diagnostic information"

    Hopefully someone could share some knowledge.
    Thanks in advance.


Log in to reply