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
Super Contributor
Posts: 398
Registered: ‎01-12-2011
My Device: Q10
My Carrier: Fido

Crash when trying to access Application's NavigationPane properties

[ Edited ]

Hi,

 

I'm trying to pop a screen by calling pop() on the NavigationPane which holds it. But it crashes, in fact it crashes when I try to access anything from the NavigationPane. Here is what I'm trying to do:

 

Application *a = Application::instance();

 

//((ApplicationUI*)a)->myNavPane->pop();

 

NavigationPane *nav = ((ApplicationUI*)a)->myNavPane;

 

nav->pop();

 

The following code also crashes:

 

if(((ApplicationUI*)a)->myNavPane->isPeekEnabled())

{

       //This crashes

}

 

I have no idea what the problem is as the error message is not descriptive:

 

Process 44814560 (Test5) terminated SIGSEGV code=1 fltno=11 ip=7898293c(/base/usr/lib/libbbcascades.so.1@_ZN2bb8cascades10VisualNode19removeAllAnimationsEv+0x1bc3) mapaddr=0016893c. ref=00000029

 

Also, the following proves that my NavigationPane is not null:

 

if(((ApplicationUI*)a)->myNavPane== NULL)

{

    qWarning() << "NavPane is NULL";

}

else

{

    qWarning() << "NavPane is NOT NULL";

}

 

Any help would be great!!

Developer
Posts: 19
Registered: ‎07-02-2013
My Device: BlackBerry Q10
My Carrier: Telus

Re: Crash when trying to access Application's NavigationPane properties

Even though your NavPane may not be NULL, it might be pointing to some garbage memory location (ie: if it was destroyed).

 

Can you give a bit more insight as to how other controls are interacting with your navpane?

Super Contributor
Posts: 398
Registered: ‎01-12-2011
My Device: Q10
My Carrier: Fido

Re: Crash when trying to access Application's NavigationPane properties

I decided to give this up and instead pass the NavigationPane pointer to my new screen's constructor, this allows me to push and pop with ease. Thanks anyway! Spent way too much time on this (almost 2 days) and we have a deadline to hit, this may not be the cleanest way but it works.

Developer
Posts: 526
Registered: ‎05-17-2009
My Device: 9900
My Carrier: ATT

Re: Crash when trying to access Application's NavigationPane properties

First, you should run it in debug mode to get a better stack trace and help you out. Second, did you subclass Application? Theres not really any reason to do that and it will only create problems most likely. Your ApplicationUI class can just be a QObject subclass that you use to setup the UI. Make that a singleton class and reference it from anywhere to get the navpane. The crash also looks like something is crashing when its trying to clean up a page, make sure nothing is happening in the destructor that is cleaning up things that your page isnt the parent of.
Like all of my posts
Highlighted
Developer
Posts: 96
Registered: ‎06-05-2012
My Device: Developer
My Carrier: Developer

Re: Crash when trying to access Application's NavigationPane properties

Hi,

use below code:
QmlDocument *qml;
//Name of Your QML file whare you declare Navigation pane.
qml = QmlDocument::create("asset:///pages/name_of_your_qml_file.qml");

NavigationPane *root_navpane;
root_navpane = qml->createRootObject<NavigationPane>();
//Then You can use
root_navpane->pop();

Thanks & Regards,
Anand Sharma