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
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B
My Carrier: BSNL INDIA

WebView freezes and then crashes

Hi,

I have this slot which is connected to a LOGIN button and when the page is loaded for the first time, it works with no visible errors except that it doesn't get past the login page. Actually, after the login is succesfull, the page should display the content provided by FB and change the desktop BG to BLUE. It works fine from my PC as well as the BB browser, but it gets frozen after the login page. And when i press the back button and again press the LOGIN button, the app simply crashes.

 

void ApplicationUI::goToFB()
{
	qDebug()<<"opened goToFB";
	settingsWebpage->setUrl(QUrl("http://connectapp.3owl.com"));

	qDebug()<<"here";
	
	settingsPane->push(webPagePage);
}

 When i see the console after it crashes, it shows "opened goToFB" but doesn't display "here". Which means that something might be wrong with the WebView. Any ideas guys?

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: WebView freezes and then crashes

Have you checked that settingsWebpage is a valid object?

Can you post how you assign this, i.e. findChild or C++ creation?

 

Any errors or warnings in the log?

 

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B
My Carrier: BSNL INDIA

Re: WebView freezes and then crashes

yes, i've checked it. If it's not, the webview shouldn't open for the first time right?

 

settingsWebPage = new WebView;

 

the app crashes when i open the webview for the 2nd time and if i start the app again and open the webview, it works just fine, with a valid message posted from the javascript in the webpage.

 

If i open the webview for the first time, the webview freezes after login page and if i close the app and open the webview again, it works just fine. The app closes only when i try to open the webview again without closing the app.

 

no, there are no errors related to this webview, only some 

 

ERROR: Context: Object name=" "DockLayout" " [objectId= 98 ] not unrealized

 

nothing else

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: WebView freezes and then crashes

Can you post the code that is responsible for creating and destroying (if you have one) the WebView object?


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B
My Carrier: BSNL INDIA

Re: WebView freezes and then crashes

settingsWebpage = new WebView;

connect(settingsWebpage, SIGNAL(minContentScaleChanged(float)), webScroll->scrollViewProperties(), SLOT(setMinContentScale(float)));
connect(settingsWebpage, SIGNAL(maxContentScaleChanged(float)), webScroll->scrollViewProperties(), SLOT(setMaxContentScale(float)));
connect(settingsWebpage, SIGNAL(messageReceived(QVariantMap)), this, SLOT(handleWebMessage(QVariantMap)));
connect(settingsWebpage, SIGNAL(loadingChanged(bb::cascades::WebLoadRequest*)), this, SLOT(handleWebLoading(bb::cascades::WebLoadRequest*)));
connect(settingsWebpage, SIGNAL(loadProgressChanged(int)), this, SLOT(handleWebLoadIndicator(int)));

QVariantMap map;
map["initial-scale"] = 1.0;
map["width"] = "device-width";
settingsWebpage->settings()->setViewportArguments(map);

webScroll= new ScrollView;
webScroll->setContent(settingsWebpage);

 

 

delete settingsWebpage;

 

 

the first code snippet contains every place where the settingsWebPage is referenced/used other than where it is set a Url, which is given in the last post.

 

The 2nd one comes within my class's destructor.

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: WebView freezes and then crashes

Without the function code and the functions where they are called from this doesn't really help.

 

Can you edit the above post and put in the full code only removing functions that have no relevance to the WebView.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B
My Carrier: BSNL INDIA

Re: WebView freezes and then crashes

[ Edited ]
void ApplicationUI::displaySettings()
{
	if(settingsFirstTime)
	{
		settingsFirstTime = FALSE;

		settingsPane = new NavigationPane;
		settingsPage = new Page;
		webPagePage = new Page;

		settingsWebpage = new WebView;

		webScroll= new ScrollView;
		webScroll->setPreferredHeight(1280.0f);
		webScroll->scrollViewProperties()->setPinchToZoomEnabled(TRUE);
		webScroll->scrollViewProperties()->setScrollMode(ScrollMode::Both);

		QVariantMap map;
		map["initial-scale"] = 1.0;
		map["width"] = "device-width";
		settingsWebpage->settings()->setViewportArguments(map);

		connect(settingsWebpage, SIGNAL(minContentScaleChanged(float)), webScroll->scrollViewProperties(), SLOT(setMinContentScale(float)));
		connect(settingsWebpage, SIGNAL(maxContentScaleChanged(float)), webScroll->scrollViewProperties(), SLOT(setMaxContentScale(float)));
		connect(settingsWebpage, SIGNAL(messageReceived(QVariantMap)), this, SLOT(handleWebMessage(QVariantMap)));
		connect(settingsWebpage, SIGNAL(loadingChanged(bb::cascades::WebLoadRequest*)), this, SLOT(handleWebLoading(bb::cascades::WebLoadRequest*)));
		connect(settingsWebpage, SIGNAL(loadProgressChanged(int)), this, SLOT(handleWebLoadIndicator(int)));

		webPageContainer = Container::create();
		webPageContainer->add(webScroll);

		webScroll->setContent(settingsWebpage);
} } void ApplicationUI::goToFB() { qDebug()<<"opened goToFB"; settingsWebpage->setUrl(QUrl("http://connectapp.3owl.com")); qDebug()<<"set url"; settingsPane->push(webPagePage); } void ApplicationUI::handleWebLoadIndicator(int perc) { qDebug()<<"web load %: "<<perc; } void ApplicationUI::handleWebLoading(bb::cascades::WebLoadRequest* loadRequest) { //qDebug()<<"WEB LOADING HANDLED"; if(loadRequest->status() == WebLoadStatus::Started) { qDebug()<<"WebView started"; } else if(loadRequest->status() == WebLoadStatus::Succeeded) { qDebug()<<"WebView succeeded"; } else if(loadRequest->status() == WebLoadStatus::Failed) { qDebug()<<"WebView failed"; } } void ApplicationUI::handleWebMessage(QVariantMap postedMessage) { qDebug()<<"MESSAGE RECEIVED!!!!!"; } void ApplicationUI::handleWebNavigationChange(bb::cascades::WebNavigationRequest* navRequest) { qDebug()<<navRequest->url(); } ApplicationUI::~ApplicationUI { delete settingsWebPage; //also deleted all other objects }

 this is it.

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: WebView freezes and then crashes

[ Edited ]

Are you still hiding code because in the code you've posted half the objects aren't connected to each other?

 

Is this the full displaySettings function, as obviously without setting up a proper page this will crash?

 

If you're connecting all the elements together somewhere can you also post that code.

 

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 123
Registered: ‎09-18-2013
My Device: Dev Alpha B
My Carrier: BSNL INDIA

Re: WebView freezes and then crashes

this is the code for everything that's connected to the WebView. I thought you wanted to see only the code that was relevent to the WebView.. And that's what I have given. There is no other place where the WebView is referenced. If you want, I can give you the full code for displaySettings() ofcourse. Smiley Happy

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: WebView freezes and then crashes

What I'm trying to do is spot a memory leak or memory access problem so I really need all the code that leads up to the creation of the WebView, so navigationPane, trigger that loads your settings page etc.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.