Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
PtSyFr
Posts: 31
Registered: ‎08-30-2010
My Device: Not Specified
Accepted Solution

Qt/navigator_invoke crash

Hi,

 

For opening a website in the native browser (Playbook 2.0.1) I use "navigator_invoke" function:

 

    QString url = "http://www.rim.com";
    char* dummy = 0;
    navigator_invoke(url.toAscii(), &dummy);
    if (dummy) {
        free(dummy);
    }

 

I use Qt and Qml. Interestingly this works sometimes, but more often fails with the following exception:

Process 42967215 (testapp) terminated SIGSEGV code=1 fltno=11 ip=7809b6e8(/base/lib/libpps.so.1@pps_encoder_reset+0x4) mapaddr=000026e8. ref=72626954

 

The method is invoked by a signal coming from Qml. What could cause this termination?

 

Regards,

 

 

Please use plain text.
BlackBerry Development Advisor
jhoffmann
Posts: 38
Registered: ‎10-26-2011
My Device: BlackBerry Bold 9900
My Carrier: Rogers

Re: Qt/navigator_invoke crash

You need to use bps_free(dummy).

 

If you don't care about the err value, don't create a dummy at all, use navigator_invoke(url.toAscii(), NULL);

 

 

https://developer.blackberry.com/native/reference/com.qnx.doc.bps.lib_ref/com.qnx.doc.bps.lib_ref/to...

Please use plain text.
Contributor
PtSyFr
Posts: 31
Registered: ‎08-30-2010
My Device: Not Specified

Re: Qt/navigator_invoke crash

Thanks for the suggestions but the problem remains with the altered code as well.

Please use plain text.
BlackBerry Development Advisor
jhoffmann
Posts: 38
Registered: ‎10-26-2011
My Device: BlackBerry Bold 9900
My Carrier: Rogers

Re: Qt/navigator_invoke crash

Did you call bps_initialize() on that thread?  If your app is single-threaded call bps_initialize() somewhere near the start of main() and bps_shutdown() when you're exiting.  On any thread that will use bps do the same in the thread's run function.

Please use plain text.
Developer
jheron
Posts: 188
Registered: ‎01-27-2012
My Device: playbook
My Carrier: ...

Re: Qt/navigator_invoke crash

There is no need to use the bps libs. Use Qt.openUrlExternaly("url") I have not tried it for the browser but its flawless for the pb native email app so I am sure it will also work with the browser.

Here is an example of how I open the email application from qml:

 Qt.openUrlExternally("mailto:?subject=Results from PlayBook&body=" + texResultBody.text);

 Cheers,

Jon

Please use plain text.
Developer
jheron
Posts: 188
Registered: ‎01-27-2012
My Device: playbook
My Carrier: ...

Re: Qt/navigator_invoke crash

I forgot to add the wiki article for Qt.openUrlExternally:

http://www.developer.nokia.com/Community/Wiki/How_to_use_Qt.openUrlExternally_in_QML

QDesktopServices also works from Qt c++ projects.

I would recomend staying away from the bps libs as much as possible so you can publish your apps on Symbian, Meego, Android and desktops too!

Cheers,

Jon

Please use plain text.
Contributor
PtSyFr
Posts: 31
Registered: ‎08-30-2010
My Device: Not Specified

Re: Qt/navigator_invoke crash

[ Edited ]

"bps_initialize()" did the trick. 

I already tried " Qt.openUrlExternally(mailto: but also http: )" before but with that I got QDesktopServices::launchWebBrowser not implemented". That's why I switched to bps.

 

Probably QDesktopServices does not work for me because I am using the old provided (by RIM) Qt binaries. These are considerably smaller (-2MB) than the manually compiled ones from git source but might have some bugs.

Please use plain text.
Contributor
PtSyFr
Posts: 31
Registered: ‎08-30-2010
My Device: Not Specified

Re: Qt/navigator_invoke crash

[ Edited ]

I just checked again. Indeed, when using the latest binaries compiled from Qt git source, then QDesktopServices do work, so this problem is solved :smileyhappy:.

 

But with this latest source there seem to be (more) other problems with networking when using QNetworkAccessManager: with the original old binaries http access works, https does not. With the new binaries (which seem to include some new internal wrapping to bps libraries) neither works. I suspect that the new Playbook beta firmware, or even the Blackberry OS 10 beta is required.

Please use plain text.
Developer
HorizonXP
Posts: 133
Registered: ‎03-28-2011
My Device: BlackBerry 9900 & PlayBook
My Carrier: Bell

Re: Qt/navigator_invoke crash

I'm seeing issues with the Qt networking stuff too. I'm trying to load an Image in QML using a remote URL as its source, and I'm seeing this error:

virtual void EventDispatcherBlackberry::registerSocketNotifier(QSocketNotifier*) bps_add_fd() failed

 That error occurs in this file:

http://qt.gitorious.org/qt/qt/blobs/4.8/src/corelib/kernel/qeventdispatcher_blackberry.cpp

 

And QML's Image comes from these files:

http://qt.gitorious.org/qt/qt/blobs/4.8/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
http://qt.gitorious.org/qt/qt/blobs/4.8/src/declarative/util/qdeclarativepixmapcache.cpp

 

Hopefully some KDAB guys can provide insight.

 

For the OP, I use QDesktopService to open my URL in Qt, works flawlessly.


Founder of Pulsecode Inc. and taab
Authomator - Two-factor authentication codes on BlackBerry 10 - http://www.xitijpatel.com/ - Follow @xitijpatel
Is there a helpful or useful post in this thread? Click the thumbs up on it so that other people can find it more easily!
Please use plain text.
Contributor
PtSyFr
Posts: 31
Registered: ‎08-30-2010
My Device: Not Specified

Re: Qt/navigator_invoke crash

That's exactly the same message I get too.
Generally it's dangerous to work with the latest Qt source because the underlying system (Playbook OS 2.x/OS 10) are changing as well. That's one reason why I am currently staying with the old Qt SDK.
Please use plain text.