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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB
My Carrier: Vip

Re: How to hunt down a segfault?

Try hard-coding this->formula = "whatever"; just for test. If that fails, something is wrong with the libs.
Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: How to hunt down a segfault?

The problem is not in DataServiceFormula::setFormula's implementation (I am 99% sure)

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to hunt down a segfault?


borceg wrote:
Try hard-coding this->formula = "whatever"; just for test. If that fails, something is wrong with the libs.

Good idea.

first attempt: pass a fixed string

dsFormula->setFormula("c1");

 no change.

second attempt: change the setter (i renamed the parameter)

void DataServiceFormula::setFormula(QString aformula) {
	formula = "c1";
	//this->formula = formula;
}

 no change, still a segfault.

 

When i comment out the whole function it runs:

void DataServiceFormula::setFormula(QString aformula) {
	//formula = "c1";
	//this->formula = formula;
}

Now i set a breakpoint in there, i get this:

debug.png

 

Doesn't this mean the object is there?

But when i try to access it with qDebug() << "this: " << this; i get a segfault again.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: How to hunt down a segfault?

What makes you think that 'the object is there'?

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to hunt down a segfault?

the value column does not say 0x0, but i have to admit, its just a guess.
Still, the debugger enters the set method and executes code there, would it do that if the object was not existing?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: How to hunt down a segfault?

C does not check on pointers. When a variable is created there is no guarantee that it'll be initialized with zero. When an object is destroyed then there is no guarantee that poniter vairable that was pointing to this object will be 'nullled'

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to hunt down a segfault?

ok. Why would my object be destroyed? I assumed that an object i create with "new" exists until i call its destructor or call delete/deletelater on the pointer.

Can I check "on pointer"?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: How to hunt down a segfault?

it might go out of visibility... it is impossible to help you without seeing more source code, that is why I asked for it -)

You can check on pointers.

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to hunt down a segfault?

Could the issue be related to not initializing the pointer with NULL?
Basically i assume that getEnabledFormula returns NULL, but maybe that is not correct?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: How to hunt down a segfault?

In my opinion the issue is you are trying to access non existent object via pointer. It does not really matter whether this pointer = NULL or anything else.