Ciao Luciano

I have cracked it!

I should have read the QtCreator Debug output more closely.

Using a constructor based on yours, I get:

   [D] SatInfoSource::SatInfoSource:18 - No satellite info source available

as the demo starts up.

The problem occurs when myGeoSatelliteInfoSource->startUpdates() is called without a satellite info source being available.

However if I check for that with an if{} (as below), then the app no longer crashes.


void SatInfoSource::startUpdates() {
    if (myGeoSatelliteInfoSource) {
        myGeoSatelliteInfoSource->startUpdates();
    }
    else {
qDebug() << "Start Updates requested, but no position info source available";
    }
}

Me thinks time for a piece of Christmas Cake.

Thanks

Chris


Zitat von christopher.l...@thurweb.ch:

Ciao Luciano

Thanks for the ideas. I agree this is most likely down to a missing "real gps" on the emulator. If that is the case then it would be fantastic if the emulator shipped with a GPS emulator (like the one on the Nokia simulator).

My constructor now looks like this:
SatInfoSource::SatInfoSource(QObject *parent) :
    QObject(parent),
myGeoSatelliteInfoSource(QGeoSatelliteInfoSource::createDefaultSource(this)),
    _satsInUse(0),
    _satsInView(0)
{
    if (myGeoSatelliteInfoSource) {
            qDebug() << "position info source available";
connect(myGeoSatelliteInfoSource, SIGNAL(satellitesInViewUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(onSatsInViewUpdated(const QList<QGeoSatelliteInfo> &))); connect(myGeoSatelliteInfoSource, SIGNAL(satellitesInUseUpdated(const QList<QGeoSatelliteInfo> &)), this, SLOT(onSatsInUseUpdated(const QList<QGeoSatelliteInfo> &)));
        }
    else {
            qDebug() << "No position info source available";
    }
}

However I still get the crash.

One thing that I have noticed, I am using QGeoSatelliteInfoSource, where as your code uses QGeoPositionInfoSource. (You may need to read that twice to see the difference 8-) ). I wonder if this is a change from Qt4 to Qt5? I will do a bit of googling and search for examples on my host.

1000 grazie

Chis

p.s. according to FedEx my phone has now made it via Charles de Gaulle to Basel, and should be delivered to Zurich tomorrow, so there is a chance that I can try this on real hardware before the end of the year ... touch wood.

Zitat von "Luciano Montanaro" <mikel...@gmail.com>:

I had crashes as well...

My code looks similar to yours, and I experienced the crash as well
(in the emulator, I suspected because there is no GPS on it, but...)

I found out that I needed to check for the positionInfoSource being valid:

Relevant snippets here:

StationListProxyModel::StationListProxyModel(QObject *parent) :
   QSortFilterProxyModel(parent),
   positionInfoSource(QGeoPositionInfoSource::createDefaultSource(this)),
   m_here(44.5, 9.0),
   m_filterRecentOnly(false)
{

  ...

   if (positionInfoSource) {
       qDebug() << "position info source available";
connect(positionInfoSource, SIGNAL(positionUpdated(QGeoPositionInfo)),
               SLOT(updatePosition(QGeoPositionInfo)));
       positionInfoSource->setUpdateInterval(5000);
   } else {
       qDebug() << "No position info source available";
   }

...

}

On Sun, Dec 29, 2013 at 11:02 AM,  <christopher.l...@thurweb.ch> wrote:
Curiouser and curiouser. Today the app still exits on GPS Startup, but the
Signal 11 error is not being reported, even though this was repeatedly the
case last night.

In the meantime I have created a throwaway demo SatInfoSourceDemo
illustrating the problem. (Basically the standard Sailfish template, +
satinfosource.h and .cpp)

The app exits as soon as satInfoSource.startUpdates(); is called. (In this
demo from the Pulley Menu on FirstPage.qml

I am guessing the problem is either in my satinfocource plugin, or more
likely in the Qt5Positioning Library this is calling. The Harmattan
equivalent of htis code works on a real N9.

The code of the Throwaway demo is pasted below.

Thanks

Chris


yaml
PkgBR: qt5-qtpositioning-devel
Requires: qt5-qtpositioning


//start satinfosource.h
#ifndef SATINFOSOURCE_H
#define SATINFOSOURCE_H

#include <QObject>

#include <QtPositioning/QGeoSatelliteInfoSource>

class SatInfoSource : public QObject
{
   Q_OBJECT
   Q_PROPERTY(int satsInView READ satsInView NOTIFY
satellitesInViewChanged)
   Q_PROPERTY(int satsInUse READ satsInUse NOTIFY satellitesInUseChanged)


public:
   explicit SatInfoSource(QObject *parent = 0);
   ~SatInfoSource();

   Q_INVOKABLE void startUpdates();
   Q_INVOKABLE void stopUpdates();

   int satsInView() const;
   int satsInUse() const;

signals:
   void satellitesInViewChanged(const int &satsInView);
   void satellitesInUseChanged(const int &satsInUse);


private slots:
   void onSatsInViewUpdated(const QList<QGeoSatelliteInfo> &list);
   void onSatsInUseUpdated(const QList<QGeoSatelliteInfo> &list);

private:
    QGeoSatelliteInfoSource *myGeoSatelliteInfoSource;
    int _satsInUse;
    int _satsInView;

};

#endif // SATINFOSOURCE_H
//end satinfosource.h

//start satinfosource.cpp
#include "satinfosource.h"
#include <QDebug>

SatInfoSource::SatInfoSource(QObject *parent) :
   QObject(parent), _satsInUse(0), _satsInView(0)
{
   myGeoSatelliteInfoSource =
QGeoSatelliteInfoSource::createDefaultSource(0);
   connect(myGeoSatelliteInfoSource, SIGNAL(satellitesInViewUpdated(const
QList<QGeoSatelliteInfo> &)), this, SLOT(onSatsInViewUpdated(const
QList<QGeoSatelliteInfo> &)));
   connect(myGeoSatelliteInfoSource, SIGNAL(satellitesInUseUpdated(const
QList<QGeoSatelliteInfo> &)), this, SLOT(onSatsInUseUpdated(const
QList<QGeoSatelliteInfo> &)));
}

SatInfoSource::~SatInfoSource()
{
}

void SatInfoSource::startUpdates() {
   myGeoSatelliteInfoSource->startUpdates();
}

void SatInfoSource::stopUpdates() {
   myGeoSatelliteInfoSource->stopUpdates();
}

int SatInfoSource::satsInView() const
{
   return _satsInView;
}

int SatInfoSource::satsInUse() const
{
   return _satsInUse;
}

void SatInfoSource::onSatsInViewUpdated(const QList<QGeoSatelliteInfo>
&list) {
   int newInView = list.count();
   if (newInView != _satsInView) {
       qDebug() << "satInfoSource.cpp: onSatsinViewUpdated: " <<
QString::number(newInView, 'g', 2);
       _satsInView = newInView;
       emit satellitesInViewChanged(newInView);
   }

}

void SatInfoSource::onSatsInUseUpdated(const QList<QGeoSatelliteInfo> &list)
{
   int newInUse = list.count();
   if (newInUse != _satsInUse) {
       qDebug() << "satInfoSource.cpp: onSatsinUseUpdated: " <<
QString::number(newInUse, 'g', 2);
       _satsInUse = newInUse;
       emit satellitesInUseChanged(newInUse);
   }
}
//end satinfosource.cpp

//start SatInfoSourceDemo.qml
import QtQuick 2.0
import Sailfish.Silica 1.0
import "pages"

ApplicationWindow
{
   initialPage: Component { FirstPage { } }
   cover: Qt.resolvedUrl("cover/CoverPage.qml")
}
//end SatInfoSourceDemo.qml


//start FirstPage.qml
import QtQuick 2.0
import Sailfish.Silica 1.0
import SatInfoSource 1.0 //for info about satellites (in view, in use)

Page {
   id: page

   SatInfoSource {
       id: satInfoSource

       onSatellitesInUseChanged: {
           console.log("GPSBackEnd: SatellitesInUseChanged! " + satsInUse +
"; " + thisGPSBackEnd.satsInUse);
       }
       onSatellitesInViewChanged: {
           console.log("GPSBackEnd: SatellitesInViewChanged! " + satsInView
+ "; " + thisGPSBackEnd.satsInView);
       }
   }

   SilicaFlickable {
       anchors.fill: parent
       PullDownMenu {
           MenuItem {
               text: "Start SatInfoSource"
               onClicked: {
                   console.log("turning GPS on")
                   satInfoSource.startUpdates();
               }
           }
       }
   }
}
//end FirstPage.qml

//start SatInfoSourceDemo.cpp
#ifdef QT_QML_DEBUG
#include <QtQuick>
#endif

#include <sailfishapp.h>
#include "satinfosource.h"

int main(int argc, char *argv[])
{
   qmlRegisterType<SatInfoSource>("SatInfoSource",1,0,"SatInfoSource");
   return SailfishApp::main(argc, argv);
}
//end SatInfoSourceDemo.cpp

//start SatInfoSourceDemo.pro
TARGET = SatInfoSourceDemo

CONFIG += sailfishapp

QT += positioning

SOURCES += src/SatInfoSourceDemo.cpp \
   src/satinfosource.cpp

HEADERS += \
   satinfosource.h

OTHER_FILES += qml/SatInfoSourceDemo.qml \
   qml/cover/CoverPage.qml \
   qml/pages/FirstPage.qml \
   rpm/SatInfoSourceDemo.spec \
   rpm/SatInfoSourceDemo.yaml \
   SatInfoSourceDemo.desktop
//end SatInfoSourceDemo.pro




Zitat von "Andrey Kozhevnikov" <coderusin...@gmail.com>:


use gdb, bro 8)

On 28.12.2013 22:45, christopher.l...@thurweb.ch wrote:

Hi All

My application quits unexpectedly during startup, apparently due to
"signal 11".

This seems to be caused by turning the GPS on, as the error occurs
immediately after the app does that.

I experience this on the Emulator, so it maybe down to the Emulator not
having a real GPS. (my Jolla phone is currently in transit between Vantaa
and Zurich according to Fedex).

I will create a throwaway demo with just GPS to prove / disprove if the
error is caused by GPS activate (or just bad timing).

Googling for Signal 11 has revealed little. I have come across some
references to this error on Android related to memory leaks.

journalctl output is below:


Chris


Dec 28 18:22:57 SailfishEmul landed25_QT5[721]: [D] onStatusChanged:59 -
MainPage: turning GPS on ...
Dec 28 18:22:57 SailfishEmul landed25_QT5[721]: [D] onGPS:36 - turning
GPS on
Dec 28 18:22:57 SailfishEmul mapplauncherd[594]: Boosted process
(pid=721) was terminated due to signal 11
Dec 28 18:22:57 SailfishEmul invoker[751]: error: Can't send signal 11 to
application [721]: No such process

_______________________________________________
SailfishOS.org Devel mailing list


_______________________________________________
SailfishOS.org Devel mailing list




_______________________________________________
SailfishOS.org Devel mailing list



--
Luciano Montanaro

Anyone who is capable of getting themselves made President should on
no account be allowed to do the job. -- Douglas Adams
_______________________________________________
SailfishOS.org Devel mailing list




_______________________________________________
SailfishOS.org Devel mailing list




_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to