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
Developer
jmoukel
Posts: 111
Registered: ‎07-05-2012
My Device: none
My Carrier: MOvistar

BB10: C++ Crash After Adding an Integer Member to My Class

[ Edited ]

Hey guys,

 

just as the title says, my app crashes after adding an int class member to one of my classes and then initializing it in the constructor. This class is the parent of many other classes I have and it's a child of QObject.

 

Any idea why it crashes for such a simple thing?

 

Thanks in advance.

Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: BB10: C++ Crash After Adding an Integer Member to My Class

Hi!

Please post the header file for this class, maybe we will see something.

Try to clean all & rebuild, this helps sometimes.
Is this variable used anywhere?

Also try to run the application in debugging mode to determine the exact place where it crashes. Function name should appear in stack trace.

If it doesn't , add log statements over the code starting from main() to determine the exact crash location.
qDebug() << "myLogText\n"; // use \n for flushing the output

Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Developer
jmoukel
Posts: 111
Registered: ‎07-05-2012
My Device: none
My Carrier: MOvistar

Re: BB10: C++ Crash After Adding an Integer Member to My Class

[ Edited ]

Hi Zmey,

 

thanks again for your help.

 

I already cleaned and rebuild. That didn't work.

 

I tracked the app in debugging mode and it looks like it doesn't crash in any function. It just crashes just after creating (not while creating) an instance of one of its child classes. This is what the stack shows:

 

  • SignalKill_r() at 0x14920c4
  • rand_r() at 0x14825a4
  • rand_r() at 0x14825a4

And those are not functions I created.

 

This is my header code. "problemVar" is the member I told you about.

 

#ifndef DATA_MANAGER_HPP
#define DATA_MANAGER_HPP

#include "GlobalData.hpp"

#include <QObject>

#include <bb/cascades/Application>

class DataManager : public QObject
{
	Q_OBJECT

    Q_PROPERTY(QString localImage READ getLocalImage NOTIFY imageChanged)

public:
	DataManager();
	~DataManager();
	int getStatus();
	void setStatus(int _status);
	void setQmlAskedForInfo(bool value);
	bool getQmlAskedForInfo();
	void setMakeChildRequestsASAP(bool value);
	bool getMakeChildRequestsASAP();

	QString getLocalImage();
	void setLocalImage(QString _localImage, int askerPositionInList);
	void loadXml(int xmlNumber);

	// "status" (the member variable) possible values
	static const int NOT_LOADED 	= 0;
	static const int LOADED			= 1;
	static const int WAITING		= 2;
	static const int PROBLEM		= 3;

private:
	int status;
int problemVar; bool makeChildRequestsASAP; bool qmlAskedForInfo; QString localImage; signals: void stoppedWaiting(); void imageChanged(); public slots: void emitStoppedWaitingSignal(); }; #endif

 

Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook
My Carrier: x

Re: BB10: C++ Crash After Adding an Integer Member to My Class

So if you remove this variable from class declaration it works ok?

Please use plain text.
Developer
borceg
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB
My Carrier: Vip

Re: BB10: C++ Crash After Adding an Integer Member to My Class

Post the constructor from your cpp file.
Please use plain text.
Developer
jmoukel
Posts: 111
Registered: ‎07-05-2012
My Device: none
My Carrier: MOvistar

Re: BB10: C++ Crash After Adding an Integer Member to My Class

Yes, if I remove this "problemVar" from the class declaration, it works. 

 

I've try changing its name, and adding other members of diferrent types, and i doesn't work.

 

This is the constructor of the class:

DataManager::DataManager()
{
	status = NOT_LOADED;
	makeChildRequestsASAP = false;
	qmlAskedForInfo = false;
        localImage = "app/native/assets/img/aguardeMovieImg.png";
        problemVar = 0;
}

 

 

 

Please use plain text.