Application crashes when I expose C++ groupDataModel in qml

Hello world

in my application, I have discovered in a container list. When I click on one of these items in the list another page is loaded. The user interface is qml. It works very well. But now I want to add data to the page. If I do it crashes without warning or error.

Here is the part of the code inportant:

// Main.qml[...]onTriggered: {
                    var selectedItem = dataModel.data(indexPath);

                    var page = Qt.app.doLoadPageDetails();

                    navigationPane.push(page);
                }[...]

and here's what the doLoadPageDetails function defined in C++:

// applicationui.cppPage* ApplicationUI::doLoadPageDetails(){    QmlDocument *qml = QmlDocument::create("asset:///PageDetails/PageDetails.qml").parent(this);
    qml->setContextProperty("app", this);

    Page* newPage = qml->createRootObject();

    // Create root object for the UI
     AbstractPane *root = qml->createRootObject();

     GroupDataModel *contactModel = new GroupDataModel;
        // ----> here I fill the data model with contacts

    // Connect to list view and update model
     ListView *contactListView = root->findChild("listContacts");

    contactListView->setDataModel(contactModel); <----- here my app crashes

    return newPage;
}
Page{
...
  Container{
...
    Container{
...
      ListView{
...
        id: listContacts
        dataModel: groupDataModel
        listItemComponents: [
          ListItemComponent {
            StandardListItem {
              title: ListItemData.personName
              description: ListItemData.mail
              status: ListItemData.more
...
            }
          }
        ]
      }
    }
  }
}

I discovered by messages from debugging the accident happens when I want to inject the data to my page in qml model.

Another point of my application, it works. But I can't know where the differences are. The only difference that I see so far is that in the other page ListView is inside a container. Not like here the ListView is inside a container which is once again within a container.

Has anyone an idea what I can try to understand what is the cause of this accident? Without any error message, it is difficult to find the answer.

Found the solution.

I forgot to set the objectname in the ListView.

...ListView{  id: listContacts
  objectName: "listContacts"}

I thought id would be the link between qml and C++.

Tags: BlackBerry Developers

Similar Questions

  • Our published application crashes when the user is not connected to WiFi

    It became clear after the last launch edition our published application crashes when the user is not connected to WiFi.

    This is a new one on us, someone at - it ideas?

    There was a bug in all versions of Viewer 24 and earlier that have arisen during the last iOS updated acme outside. If you upgrade to v25 or later version the issue will go away.

    Neil

  • LabVIEW application crashes when you exit a VI with one or several clients on remote control

    Hi all

    This is the question that I met with LabVIEW 8.2 and LabVIEW 8.6. I publish one of the screws dynamically launch my application as a Web page. Then I load the application and launch this dynamic VI and connect to this VI by using a web browser from a PC intranet. Then if I try to exit from VI when the client is still connected to it, the application crashes. Please see the attached picture.
    This behavior occurs randomly. Sometimes, everything works as expected when you exit the VI - the main screen of the application appears and in the client side, there is a "remote connection Panel is closed.
    What could be the reason for this?

    Thank you
    Luxama

    Oops... The method of 'Close links' to work correctly. I apologize for the error.

    Regarding the issue of application crash, I did this close relationship, then wait a few milliseconds and then quit the VI. Today, the application seems to work very well.

    In the meantime, I had another doubt. Is there a way to link to the application instead of a VI?

    Thank you
    Luxama

  • Application crashes when you use NotificationGlobalSettings

    In my pro:

    LIBS += -lbbplatform
    

    In my PPS:

    private:
        bb::platform::NotificationGlobalSettings* notificationGlobalSettings;
    

    In my PPC:

    notificationGlobalSettings->setMode(bb::platform::NotificationMode::Normal);
    

    My application crashes and I get the following error when I run the previous code in my PPC:

    1303830785 () process ended the SIGSEGV = 1 fltno = 11 ip=78724c5c(/base/usr/lib/libbbplatform.so.1.0.0@_ZN2bb8platform26NotificationGlobalSettings9setVolumeEi+0x49b code) mapaddr = 0003ac5c ref = 00002 a 12 bdslot = 1.

    Forget you initialize the object in your constructor, so notificationGlobalSettings is equal to a random number.

    Add this to your manufacturer:
    notificationGlobalSettings = new NotificationGlobalSettings (this);

  • Applications crash when go to file/open

    The problem started with Office 2010. Go to file/open and crashes the application. Excel has stopped working, searching online for a solution, or close the program. The issue has been expanded. I can't attach a file to my eMail. The application crashes. Same thing is happening on file save as...

    I can open a file from the Explorer. Double-click a file and all is well. File/save the works.

    The problem can be solved by deleting the user and re-create it. But it doesn't take long to make the problem reappear.

    I was not able to identify a specific activity that triggers the question.

    Look forward to a resolution.

    Read some articles. None really applied. MS FixIt program will not work wit Win7.

    I downloaded Revo Uninstaller. removed from Google Desktop, Google talk, Google Apps, a couple of FTP programs, which related to the Windows Explorer. I don't know which of these was interfering, but the problem has been resolved.

    I'll probably reinstall the stuff Google and see if they were the culprit. I suspect that the FTP program is more to blame. It works with XP. But once installed does not appear in the Explorer window. When I have the time.

  • Application crashes when I join class presentation

    So I tried to figure out how to get the filepath link to invoke my camera.  I'm at the point where I tried everything nothing helped.  My last attempt was tie the class is exposed from my source code in my QML.

    in main.cpp:

    using ::bb::cascades::Application;
    // this allows us to write "Application"
    // instead of "bb::cascades::Application"
    
    void myMessageOutput(QtMsgType type, const char* msg) {
        Q_UNUSED(type);
       fprintf(stdout, "%s\n", msg);
       fflush(stdout);
    }
    // main() is the entry point of the application. It will be called by the
    // operating system when you start the application. You should never call this
    // yourself.
    Q_DECL_EXPORT int main(int argc, char **argv)
    {
    
        qmlRegisterType("bb.platform", 1, 0, "RouteMapInvoker");
            bb::data::DataSource::registerQmlTypes();
            qmlRegisterType("bb.platform", 1, 0, "LocationMapInvoker");
            bb::data::DataSource::registerQmlTypes();
        // "Application" is the BB cascades class that handles interaction the
        // with BB10 operating system.
        Application app(argc, argv);
    
    #ifndef QT_NO_DEBUG
       qInstallMsgHandler(myMessageOutput);
       #endif
    
        // Register this type so qml can refer to enums and other symbols
        // declared in the App class.
        qmlRegisterType("Custom.lib", 1, 0, "ApplicationUI");
    
        // Create an instance of App on the stack. App's
        // constructor registers itself with Application object using setScene().
        // See app.cpp
        app.setCover(new ActiveFrame());
        ApplicationUI mainApp;
    
        // Start the application event loop (run-loop).
        return Application::exec();
    
        // When the loop is exited the Application deletes the scene which deletes
        // all its children (per Qt rules for children)
    }
    

    ApplicationUI.hpp:

    class ApplicationUI : public QObject
    {
        // Classes that inherit from QObject must have the Q_OBJECT macro so
        // the meta-object compiler (MOC) can add supporting code to the application.
        Q_OBJECT
    
        Q_PROPERTY(bb::cascades::DataModel* dataModel READ dataModel CONSTANT)
    
    public:
    
        // Describes the possible storage locations
        enum StorageLocations
        {
            StoreInQSettings, ///< objects are stored in QSettings
            StoreInFile       ///< objects are stored in custom files
        };
    
        // This allows the enum to be referred to in the qml file.
        // Note: the class also has to be registered using qmlRegisterType().
        // See the main.cpp file.
        Q_ENUMS(StorageLocations)
    
        // Creates a new App object
        ApplicationUI(QObject *parent = 0);
    
        // destroys the App object
        ~ApplicationUI();
    
        Q_INVOKABLE
            void inviteUserToDownloadViaBBM();
        Q_INVOKABLE
            void updatePersonalMessage(const QString &message);
    
            // Creates a new location object and saves it.
        Q_INVOKABLE bool addObject(const QString &name, const QString &description, const QString &datefield, const QString &lat, const QString &lon, const QString &categoryfield, const QString &mapurl, const QString &itempic);
    
        // Read all the objects from the selected storage location and
        // put them in the data model
        Q_INVOKABLE void refreshObjects();
    
        // Remove all the objects from the selected storage location.
        Q_INVOKABLE void clearObjects();
    
        // Change the first and last name of the location with the
        // provided id. Update the data model and storage.
        Q_INVOKABLE bool updateObject(const QString &id, const QString &name, const QString &description, const QString &datefield, const QString &lat, const QString &lon, const QString &categoryfield, const QString &mapurl, const QString &itempic);
    
        // Delete the location with the given id from the selected storage location.
        Q_INVOKABLE bool deleteObject(const QString &id);
    
        // Change the location we're using for the data, and
        // refresh the list.
        Q_INVOKABLE void setStorageLocation(StorageLocations strLocation);
    
            Q_INVOKABLE void addPinAtCurrentMapCenter();
            Q_INVOKABLE void clearPins();
            Q_INVOKABLE void updateDeviceLocation(double lat, double lon);
            Q_INVOKABLE QString getValueFor(const QString &objectName, const QString &defaultValue);
            Q_INVOKABLE void saveValueFor(const QString &objectName, const QString &inputValue);
            Q_INVOKABLE void InvokeCamera();
            Q_INVOKABLE void InvokeSettings();
            Q_INVOKABLE void InvokeImageViewer(const QString &urlPic);
    
            public slots:
            void childCardDone(const bb::system::CardDoneMessage &message);
    
            signals:
            void cameraCaptureCompleted(const QString &imageLink);
    //        void filterChanged();
    
    ........
    

    in my ApplicationUI.cpp

    ApplicationUI::ApplicationUI(QObject *parent)
        : QObject(parent)
        , m_lastCustomerID(0)
        , m_storageLocation(StoreInQSettings)
        , m_storage(new SettingsStorage)
    
    {
    
        // prepare the localization
            m_pTranslator = new QTranslator(this);
            m_pLocaleHandler = new LocaleHandler(this);
            invokeManager = new bb::system::InvokeManager();
            invokeManager->setParent(this);
    
            if(!QObject::connect(m_pLocaleHandler,
                SIGNAL(systemLanguageChanged()),
                this,
                SLOT(onSystemLanguageChanged()))) {
                // This is an abnormal situation! Something went wrong!
                // Add own code to recover here
                qWarning() << "Recovering from a failed connect()";
            }
    
            connect(invokeManager,
            SIGNAL(childCardDone(const bb::system::CardDoneMessage&)), this,
            SLOT(childCardDone(const bb::system::CardDoneMessage&)));
    
            // initial load
            onSystemLanguageChanged();
    
        // Initialize the data model before the UI is loaded
        // and built so its ready to be used.
        initDataModel();
    
    //    qmlRegisterType("uri",1,0,"App");
    
        QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);
        qml->setContextProperty("_app", this);
    
        AbstractPane *root = qml->createRootObject();
    
    .....
    
    void ApplicationUI::InvokeCamera()
    {
        bb::system::InvokeManager manager;
        bb::system::InvokeRequest request;
        request.setTarget("sys.camera.card");
        request.setAction("bb.action.CAPTURE ");
        request.setMimeType("image/jpeg");
        InvokeTargetReply *targetReply = manager.invoke(request);
    
    }
    
    void ApplicationUI::childCardDone(const bb::system::CardDoneMessage &message)
    {
        QString imageLink;
        if (message.reason() == "done") {
    
            imageLink = "file://" + message.data();
        }
        qDebug() << message.reason() << "\n";
        qDebug() << message.dataType() << "\n";
        qDebug() << "file://" + message.data() << "\n";
    
        emit cameraCaptureCompleted(imageLink);
    }
    

    in my QML:

    import bb.cascades 1.0
    import Custom.lib 1.0
    
    Sheet{
    
    Page{
    
    Container{
    
    Label{id: itemPic}
    
    Button{
    
    onClicked: {
    _app.InvokeCamera()
    }
    
    }
    
    }
    
    attachedObjects: [
    
    ApplicationUI {
    onCamerCapturedCompleted: {
    
    itemPic.setText(imageLink)
    
    }}
    ]
    }
    }
    

    As soon as I attach the class the application does not start and the accident, if I change it it is fine.

    Hello

    Instance of ApplicationUI is already exported to QML as _app. One possible approach connects the signal to a JS function:

    Sheet
    {
      onCreationCompleted: {
        _app.cameraCaptureCompleted.connect(captureCompleted)
      }
    
      function captureCompleted(imageLink) {
        console.log("imageLink: " + imageLink)
      }
      ...
    
    }
    

    Element using Qt Quick "Connection" is another option.

    This code should be deleted (it creates a second instance of ApplicationUI, which probably was not provided):

    qmlRegisterType("Custom.lib", 1, 0, "ApplicationUI");
    
    ...
    
    attachedObjects: [
    ApplicationUI {
    onCamerCapturedCompleted: {
    itemPic.setText(imageLink)
    }
    
  • After downgrading to iOS Beta 10 Apple music application crashes when you try to play music

    After downgrading to iOS Beta 10 my music library Apple blocks the music application when any song is chosen.

    I tried to restart the unit, turn off Apple music in settings, turn off iCloud sync music in settings and delete music in the nursery of storage again the list of artists and albums always appears with blank cover and crash trying to read any song.

    having exactly the same problem, hated the beta, so I downgraded, music Apple if I click on the button play on anything, it crashes on me. Tried all the steps that you did as well.

  • Music application crashes when you try to view playlists

    I've recently downgraded from ios to ios 9.3.2,and 10 However, I had a few problems, one of the problems is that when I try to view on the application of music playlists, it crashes, it's quite annoying because I don't want to reset my phone and I use the music app a lot!

    It seems also I can't use hue phillips and when I try to play music, it crashes

  • Application crashes when connecting remotely for debugging

    Hello again all you lovers forum useful!

    I'm debugging a strange behaviour in my application that does occur on a specific computer in special circumstances.  To do this, I have enabled debugging in my application and finally was able to see it as an option in the menu "Debug Application or Shared Library" on my local computer (I had to first find out the hard way that you cannot change the name of the application and have always run in debug mode, even if you change the name of the associated also .aliases and .ini files).

    When I try to connect to my request, the "connection status" displays lists of downloading my subVIs much and then finally downloading my main VI.  At this point, my main VI façade appears on my local computer.  However, everything freezes then, while on the remote computer, my application (waiting for correctly so that the debugger start) crashes with a generic Windows "...". has encountered a problem and needs to close"message.  If I click to more information, I see that the name is lvrt.dll (my application is usually not real-time, but it uses a timed loop or two).

    I would like suggestions as to what may cause this error and how to fix it.  Unfortunately, because it's a working application I can't post my code.  I'm using LabVIEW 2010 SP1, and two computers running Windows XP.

    Thanks in advance for your time!

    -Joe

    Well, I accidentally worked around the problem, although I never found the root cause.

    My applications MS Office had put by my it Department yesterday, and now when I compile my app, it tells me that a VI integrated Excel is broken, somewhere in the NIReport.llb folder, I added to the section 'always include' my construction specification application source file properties.  I removed NIReport.llb temporarily since I do not have the part of my application which is used to make this debugging and debugging now my application works.  Weird!  I was able to successfully debug my original problem that started this whole mess, though, so I'm happy with the final result.

    Now, I just get NIReport.llb working again.  I'm guessing there are probably an updated version to match MS Office 2010, which is my new version.  I had added NIReport.llb to support using "Easy text Report.vi" for printing.  Given that my app size dropped 50% when I got him out earlier, I can get another printing option, however.  I can solicit the opinions about it, but if so I'll so, in another thread to keep this one to.

    To anyone who has been reading this thread and thinking about how to solve my problem, thank you for your time!

    Until next time,.

    -Joe

  • Headless Application Crash when closing the user interface

    For some reason, my application without head started crashing whenever the user interface is closed. Here is the stack trace that I get headless application when I close the user interface:

    Thread [1] (STOPPED) (Suspended : Signal : SIGSEGV:Segmentation fault)
        QHostAddressPrivate::clear() at qhostaddress.cpp:293 0x1822926c
        QAbstractSocket::disconnectFromHostImplementation() at qabstractsocket.cpp:2,714 0x18243466
        qt_static_metacall() at moc_qabstractsocket.cpp:154 0x18245fa8
        QAbstractSocket::qt_static_metacall() at moc_qabstractsocket.cpp:140 0x18245fa8
        QMetaMethod::invoke() at qmetaobject.cpp:1,664 0x196a47d8
        QMetaObject::invokeMethod() at qmetaobject.cpp:1,179 0x196a6334
        invokeMethod() at qobjectdefs.h:418 0x182421e0
        QAbstractSocket::disconnectFromHost() at qabstractsocket.cpp:2,609 0x182421e0
        QAbstractSocketPrivate::canReadNotification() at qabstractsocket.cpp:634 0x18244974
        QAbstractSocketEngine::readNotification() at qabstractsocketengine.cpp:168 0x18237a60
        event() at qnativesocketengine.cpp:1,159 0x1824aeba
        QReadNotifier::event() at qnativesocketengine.cpp:1,156 0x1824aeba
        QCoreApplicationPrivate::notify_helper() at qcoreapplication.cpp:1,083 0x1969e00e
        QCoreApplication::notifyInternal() at qcoreapplication.cpp:953 0x1969de60
        sendEvent() at qcoreapplication.h:231 0x196c379e
        QEventDispatcherUNIX::activateSocketNotifiers() at qeventdispatcher_unix.cpp:894 0x196c379e
        QEventDispatcherUNIXPrivate::doSelect() at qeventdispatcher_unix.cpp:291 0x196c4042
        QEventDispatcherUNIX::processEvents() at qeventdispatcher_unix.cpp:936 0x196c42f0
        QEventLoop::processEvents() at qeventloop.cpp:149 0x1969cace
        QEventLoop::exec() at qeventloop.cpp:204 0x1969cd28
        QCoreApplication::exec() at qcoreapplication.cpp:1,225 0x196a0eda
        main() at main.cpp:39 0x10659de4
    

    Now, you will see the entire track, with the exception of the entrance of main(), seems to be part of the loop of events or other system libraries. Anyone happen to know what is happening here or be willing to help?

    Thanks in advance!

    Well, I found a solution for the bug here. I was using sockets to communicate between my headless and requests for benefits and in my slot look for disconnect events in my application without a head, I got this code:

    void disconnected()
    {
        ...
        _socket->close();
        delete _socket;
        ...
    }
    

    I then changed this slot to look something like this, that solved my problem:

    void disconnected()
    {
        ...
        _socket->close();
        _socket->deleteLater();
        ...
    }
    

    My guess is that I tried to remove the plug while he was still waiting to be delivered to her events. Using deleteLater(), the event loop is responsible for the removal of the plug once all the events have been delivered, preventing the application from crashing.

  • application crashes when jumping from article with video to another article with video

    I read a thread on this subject earlier today which dates back to January in which an Adobe employee said that this problem has been resolved, but unfortunately I knew it now. I have several articles that include videos and another article with lots of great pictures. When I try to navigate from one article to the other, the content viewer stops and goes back to the home screen. According to the thread, this is known as the memory problem and I followed the suggestions to reinstall the viewer and reboot the iPad, but it did not help. Right now the only way to use the app is to navigate to the cover and continue from there which is defeated the point of having a navigation throughout the app. I can't get out just the videos or photos in order to reduce the size of the file. Any advice? Thank you!

    Adobe DPS me technical support has called about it, it's a matter of priority and sent to engineering with my example files. I spent almost shock!

    They said that this is a problem in versions recent (20/21) and it disappears in version 22.

  • Preview app crash when recording or editing images

    When I'm editing images (jpg format) in the preview, the application crashes when saving the image. For my work, I need to add labels and arrows to photos that I take in the field. The application crashes when registering, and I lose a huge amount of time trying to figure out what's wrong. I already deleted the preference files and the problem persists. I get this from the console application:

    Thank you

    06/05/16 4:15:11.408 PM Preview [3059]: ImageIO: CreateMetadataFromXMPBufferInternal threw error #203 (property node or a duplicate field)

    06/05/16 4:15:11.411 PM Preview [3059]: ImageIO: CreateMetadataFromXMPBufferInternal threw error #203 (property node or a duplicate field)

    06/05/16 com.apple.xpc.launchd [1 4:15:11.853 PM]: (com.apple.Preview.39072 [3059]) Service was released due to the signal: Segfault: 11

    06/05/16 com.apple.xpc.launchd [1 4:15:11.886 PM]: (com.apple.ReportCrash [3065]) endpoint has been activated through legacy launch (3) API. Please go to XPC or bootstrap_check_in(): com.apple.ReportCrash

    06/05/16 com.apple.SecurityServer [79 4:15:12.191 PM]: kill auth hosts

    06/05/16 com.apple.SecurityServer [79 4:15:12.191 PM]: Session 100049 destroyed

    In the Console window, select

    DIAGNOSIS AND diagnostic USE information reports ▹ user

    (not diagnose them and use Messages) in the list of logs on the left. There is a disclosure triangle to the left of the list item. If the triangle is pointing to the right, click it so that it points downwards. You will see a list of reports of incidents. The name of each report begins with the name of the process and ends with ".crash". Select the most recent report on the process in question. The content of the report is displayed at right. Allows you to copy and paste to validate all of the content, text, not a screenshot.

    I know that the report is long, perhaps several hundred lines. Please report all this anyway.

    If you don't see any report, but you know, he had an accident, you have chosen diagnostic and using the list of Log Messages. INFORMATION on the USE of DIAGNOSTIC AND choose instead.

    In the interest of privacy, I suggest that, before posting, you change the UUID ' anonymous, ' a long string of letters, numbers and dashes in the header of the report, if it is present (it cannot be). "

    Please do not post other types of diagnostic report - they are very long and rarely useful.

    When you post the accident report, you might see an error message on the web page: "you include content in your post that is not allowed", or "the message contains invalid characters." It's a bug in the forum software. Thanks for posting the text on Pastebin, then post here a link to the page you created.

    If you have an account on Pastebin, please do not select private in exposure menu to paste on the page, because no one else that you will be able to see it.

  • Application crashes with "Store store = Session.waitForDefaultSession () .getStore ();

    Hello

    I am trying to delete the emails of my device but my application crashes when I try to fulfill the purpose of the Bank to "Store store = Session.waitForDefaultSession () .getStore (); This line.

    He works on a simulator and removes all mails, but on the device, it crashes...

    Why this is happening?

    Any idea?

    Please let me know...

    Thank you...

    Check this thread
    http://supportforums.BlackBerry.com/T5/Java-development/check-if-quot-device-can-send-email-quot-EMA...

  • WMP 11 crashes when right click on the application

    WMP 11 crashes when I right click any where on the screen of the application or you are trying to click on tools or view, among many other things. I'm trying to get the list pane to see the and if I click on playing, and the drop nothing appears. usually crashes right after that as well. Please help, I can't find anything about it!

    so, I thought about it! for anyone else who has this problem - I hope that this saving you countless hours of frustration, I've experienced...

    -J' restored wmp version 9

    -J' completely deleted all system files and applications to version 11

    -J' rebooted my computer and reinstalled version 11

    -for some reason, it works! :)

    This may seem very simple, but I've tried so many different configurations and random ideas that I'm frankly surprised, it worked! Hope this helps someone else.

  • When you click on the 'Info' to the background action bar button, the application crashes.

    Hello

    Recently, we have brought successfully a BlackBerry 10 Android app.

    Everything worked fine, except the thing that when you click on the "Info" button in the action bar that appears at the bottom of the screen - the application crashes.

    I guess that this button should display a connection, or the help page. In our application, we have such a page (like an ActionItem in the ActionBar).

    Yes, is there a way we can fix it, so that when clicking on "Info" button to view our about page? Or at least to do something to prevent the application from crashing, for example hide this button.

    PS: We tested the app in the simulator of Alpha BB 10 Dev.

    Thank you.

    Hello

    Thank you for your comments. In fact, it is a known problem in the current Runtime Android on the Simulator release BlackBerry 10. It has nothing to do with your application, as this action bar fits into the Runtime Android and not your application. Normally when you section the 'Info' button you will see a screen showing you must use the gesture of back scanning used in applications Android Runtime. If you want your own topic button, you need to create your own menu.

    See you soon,.

    Matt

Maybe you are looking for