QWebView crashes in Release, works in debug
-
Hi all,
here is my minimum example:
@
QApplication app(argc, argv);QWebView *p_WebView = new QWebView(NULL); printf("c1"); p_WebView->load(QUrl("www.google.de")); printf("c2"); p_WebView->show(); printf("c3"); return 0;
@
In debug it works, but in release it crashes before c2 is printed, such that I fear the problem is during "load(...)".
I use VS2012 and build qt by debug-and-release option, such that both debug and release libraries should have identical configuration. Do you have any idea, where (and how) I might start to search for the problem?
regards,
curtator -
Pass "0" or nothing to QWebView constructor instead of NULL. This is the only potential problem I can see in this code.
Also, if you are on Qt4, use one of QUrl's static methods, not the constructor (QUrl::fromUserInput() is a good candidate).
-
Hi, thank you for your fast replay.
Unfortunatly, nothing helps
@QApplication app(argc, argv);
QWebView *p_WebView = new QWebView(); printf("c1"); p_WebView->load(QUrl::fromUserInput("www.google.de")); printf("c2"); p_WebView->show(); printf("c3"); return 0; @
Further ideas?
-
Hello,
Read this https://bugreports.qt-project.org/browse/QTBUG-29719Best regards.
-
Shouldn't the URL start with "http://"?
-
I changed that, but that doesn't help either. Maybe it is a bug as described by rodion67.
Thank you all very much
regards,
curator -
Your minimum example would not work in any way, you are missing application main loop. May it be the problem in your real App?
P.S.: Where does my reply from yesterday gone?
-
hello,
My experimentation with this shows that it could be the URL not having the protocol.
Without specifying the http my test application will crash as described by curator.
my code is as follows:
@
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
p_WebView = new QWebView();
QUrl myUrl;qDebug() << "C1";
connect( p_WebView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
#define CRASH_VERSION
#if defined (CRASH_VERSION)
myUrl.setUrl("www.tims.com");
#else
myUrl.setUrl("http://www.tims.com");
#endifif( myUrl.isValid()) {
qDebug() << "trying to load " << myUrl.url();
p_WebView->load(myUrl);
}
else
qDebug() << "Invalid URL encountered";qDebug() << "c3";
}
@Interestingly, the QUrl returns true for isValid(), which I guess is correct since it is well formed,
but there should be some way of knowing that what you pass to QWebView::load() is not
going to be accepted. -
Thank you for the reply. I will test, if the "http://" will help on my code.