-2

My application randomly crashes. I have used web view to load some URLs and there is always a warning.

qnetworkreplyimplprivate :: error: internal problem, this method must only called ones stack

#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    setAcceptDrops(true);
    web->load(QString("http:my url"));
//    QThread *webThread = new QThread;
//    web.moveToThread(webThread);
    web->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); //Handle link clicks by yourself

    connect(web, SIGNAL(linkClicked(QUrl)),this,SLOT(urlCliked(QUrl)));
    web->showMaximized();
}
Laurel
  • 5,965
  • 14
  • 31
  • 57
Mugtaba
  • 3
  • 2

2 Answers2

0

The web pointer is dangling. It should be initialized to point to something. You probably need something like:

web = new QWebView(this);

in your constructor before accessing web as in web->load(QString("http:my url"));

You would also need to include the corresponding header:

#include <QWebView>
Hammerzeit
  • 11
  • 3
  • i have it in my mainwindow.h QWebView *web = new QWebView(); still crashes and randomly. – Mugtaba Apr 24 '16 at 04:54
  • The code you are showing here is the constructor of your class so even if you are creating the QWebView in the header in some other function it will not be called before your constructor the way the code is currently.Can you also show your mainwindow.h header file? – Hammerzeit Apr 24 '16 at 09:02
  • the space isn't enough for the code. i simply in the header file have QWebView *web = new QWebView(); and in the cpp file load an URL. – Mugtaba Apr 25 '16 at 06:40
0

I was using Qt version 5.3 on raspberry pi 2 and i have found that i was using improper gcc version within the Qt. so make sure to use the same Qt version with the correct gcc version.

Mugtaba
  • 3
  • 2