PDA

View Full Version : QWebView, Google maps



Viper666
15th October 2012, 20:06
Hi everyone,
i need help i make browser and i found bug: connection:
connect(view, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
slot loadStarted():

urlLine->RefreshButton()->setVisible(false);
urlLine->StopButton()->setVisible(true);
//progressbar->setVisible(true); when this isn't comment line it crash program i don't know why i try try, catch blocks, program has been crashed too
Thanks

wysota
15th October 2012, 20:10
Does "progressbar" point to a valid object? Where is the declaration and initialization of that object?

Viper666
16th October 2012, 14:17
Yes I have Widget- Browser in this widget is Url line search line actions(go Back, Forward...) and progress bar is in this widget and connection too

progressBar = new QProgressBar(this);
statusBar->addPermanentWidget(progressBar);

progressBar->setMaximumWidth(250);
progressBar->setMinimum(0);
progressBar->setMaximum(100);
progressBar->setValue(0);
And new tab is simple new Browser

wysota
16th October 2012, 14:52
Are you sure you are not shadowing a member variable with a local variable?

Viper666
16th October 2012, 15:21
Yes, but it do only in google maps when i try street view and when you are in google document try page and for example you type something in urlLine and load it never otherwise and

Viper666
18th October 2012, 15:07
pls help i don't know what do i can send code here if it help i try debug
0x678bb21f <+139579>:\tjmp 0x678bb1ed <ZrsR11QDataStreamR12QPaintBuffer+139529>\n"


>~" 0x678bb4df <+140283>:\tjmp 0x678bb3e3 <ZrsR11QDataStreamR12QPaintBuffer+140031>\n"
>~" 0x678bb4e4 <+140288>:\timul %edx,%eax\n"
>~" 0x678bb4e7 <+140291>:\tadd %eax,%ecx\n"
>~" 0x678bb4e9 <+140293>:\tmov %ecx,%eax\n"
>~" 0x678bb4eb <+140295>:\tsar $0x8,%eax\n"
>~" 0x678bb4ee <+140298>:\tlea 0x80(%ecx,%eax,1),%edx\n"
>~" 0x678bb4f5 <+140305>:\tsar $0x8,%edx\n"
>~" 0x678bb4f8 <+140308>:\tjmp 0x678bb38e <ZrsR11QDataStreamR12QPaintBuffer+139946>\n"
>~" 0x678bb4fd <+140313>:\tlea 0x0(%esi),%esi\n"
>~" 0x678bb500 <+140316>:\tadd $0x5c,%esp\n"
>~" 0x678bb503 <+140319>:\tpop %ebx\n"
>~" 0x678bb504 <+140320>:\tpop %esi\n"
>~" 0x678bb505 <+140321>:\tpop %edi\n"
>~" 0x678bb506 <+140322>:\tleave \n"
>~" 0x678bb507 <+140323>:\tret \n"
>~" 0x678bb508 <+140324>:\tmov %ecx,(%esp)\n"
>~" 0x678bb50b <+140327>:\tcall 0x67d1d7bc <Z6qAlphaj>\n"
>~" 0x678bb510 <+140332>:\tmov %eax,%esi\n"
>~" 0x678bb512 <+140334>:\tmov %ebx,(%esp)\n"
>~" 0x678bb515 <+140337>:\tcall 0x67d1d630 <Z4qRedj>\n"
>~" 0x678bb51a <+140342>:\tmov %eax,-0x30(%ebp)\n"
>~" 0x678bb51d <+140345>:\tmov %ebx,(%esp)\n"
>~" 0x678bb520 <+140348>:\tcall 0x67d1d7c8 <Z6qGreenj>\n"
>~" 0x678bb525 <+140353>:\tmov %eax,-0x34(%ebp)\n"
>~" 0x678bb528 <+140356>:\tmov %ebx,(%esp)\n"
>~" 0x678bb52b <+140359>:\tcall 0x67d1d66c <Z5qBluej>\n"
>~" 0x678bb530 <+140364>:\tmov %eax,-0x38(%ebp)\n"
>~" 0x678bb533 <+140367>:\tmov -0x3c(%ebp),%ecx\n"
>~" 0x678bb536 <+140370>:\ttest %ecx,%ecx\n"
>~" 0x678bb538 <+140372>:\tjle 0x678bb500 <ZrsR11QDataStreamR12QPaintBuffer+140316>\n"
>~" 0x678bb53a <+140374>:\tmov 0x8(%ebp),%eax\n"
>~" 0x678bb53d <+140377>:\tsub %esi,%eax\n"
>~" 0x678bb53f <+140379>:\tmov %eax,-0x20(%ebp)\n"
>~" 0x678bb542 <+140382>:\tmov -0x30(%ebp),%edx\n"
>~" 0x678bb545 <+140385>:\tshl %edx\n"
>~" 0x678bb547 <+140387>:\tmov %edx,-0x2c(%ebp)\n"
>~" 0x678bb54a <+140390>:\tmov -0x38(%ebp),%ecx\n"
>~" 0x678bb54d <+140393>:\tshl %ecx\n"
>~" 0x678bb54f <+140395>:\tmov %ecx,-0x28(%ebp)\n"
>~" 0x678bb552 <+140398>:\tmov -0x34(%ebp),%ebx\n"
>~" 0x678bb555 <+140401>:\tshl %ebx\n"
>~" 0x678bb557 <+140403>:\tmov %ebx,-0x1c(%ebp)\n"
>~" 0x678bb55a <+140406>:\tmov -0x34(%ebp),%eax\n"
>~" 0x678bb55d <+140409>:\tsub %esi,%eax\n"
>~" 0x678bb55f <+140411>:\tshl %eax\n"
>~" 0x678bb561 <+140413>:\tmov %eax,-0x40(%ebp)\n"
>~" 0x678bb564 <+140416>:\tmov -0x38(%ebp),%eax\n"
>~" 0x678bb567 <+140419>:\tsub %esi,%eax\n"
>~" 0x678bb569 <+140421>:\tshl %eax\n"
>~" 0x678bb56b <+140423>:\tmov %eax,-0x44(%ebp)\n"
>~" 0x678bb56e <+140426>:\tmov -0x30(%ebp),%eax\n"
>~" 0x678bb571 <+140429>:\tsub %esi,%eax\n"
>~" 0x678bb573 <+140431>:\tshl %eax\n"
>~" 0x678bb575 <+140433>:\tmov %eax,-0x48(%ebp)\n"
>~" 0x678bb578 <+140436>:\txor %edi,%edi\n"
>~" 0x678bb57a <+140438>:\tmov %esi,-0x14(%ebp)\n"
>~" 0x678bb57d <+140441>:\tjmp 0x678bb676 <ZrsR11QDataStreamR12QPaintBuffer+140690>\n"
>~" 0x678bb582 <+140446>:\txchg %ax,%ax\n"
>~" 0x678bb584 <+140448>:\tmov %ebx,%ecx\n"
>~" 0x678bb586 <+140450>:\tsub %eax,%ecx\n"
>~" 0x678bb588 <+140452>:\tmov -0x48(%ebp),%eax\n"
>~" 0x678bb58b <+140455>:\timul %ecx,%eax\n"
>~" 0x678bb58e <+140458>:\tmov -0x14(%ebp),%ecx\n"
>~" 0x678bb591 <+140461>:\timul %ebx,%ecx\n"
>~" 0x678bb594 <+140464>:\tadd %ecx,%eax\n"
>~" 0x678bb596 <+140466>:\tlea (%eax,%edx,1),%edx\n"
>~" 0x678bb599 <+140469>:\tmov %edx,%eax\n"
>~" 0x678bb59b <+140471>:\tsar $0x8,%eax\n"
>~" 0x678bb59e <+140474>:\tlea 0x80(%edx,%eax,1),%eax\n"
>~" 0x678bb5a5 <+140481>:\tsar $0x8,%eax\n"
>~" 0x678bb5a8 <+140484>:\tmov %eax,-0x18(%ebp)\n"
>~" 0x678bb5ab <+140487>:\tmov %esi,(%esp)\n"
>~" 0x678bb5ae <+140490>:\tcall 0x67d1d66c <Z5qBluej>\n"
>~" 0x678bb5b3 <+140495>:\tmov -0x20(%ebp),%ecx\n"
>~" 0x678bb5b6 <+140498>:\timul %eax,%ecx\n"
>~" 0x678bb5b9 <+140501>:\tmov -0x10(%ebp),%edx\n"
>~" 0x678bb5bc <+140504>:\timul -0x38(%ebp),%edx\n"
>~" 0x678bb5c0 <+140508>:\tadd %edx,%ecx\n"
>~" 0x678bb5c2 <+140510>:\tmov -0x28(%ebp),%edx\n"
>~" 0x678bb5c5 <+140513>:\tcmp %edx,-0x14(%ebp)\n"
>~" 0x678bb5c8 <+140516>:\tjg 0x678bb6dc <ZrsR11QDataStreamR12QPaintBuffer+140792>\n"
>~" 0x678bb5ce <+140522>:\tmov %ebx,%edx\n"
>~" 0x678bb5d0 <+140524>:\tsub %eax,%edx\n"
>~" 0x678bb5d2 <+140526>:\tmov -0x44(%ebp),%eax\n"
>~" 0x678bb5d5 <+140529>:\timul %edx,%eax\n"
>~" 0x678bb5d8 <+140532>:\tmov -0x14(%ebp),%edx\n"
>~" 0x678bb5db <+140535>:\timul %ebx,%edx\n"
>~" 0x678bb5de <+140538>:\tadd %edx,%eax\n"
>~" 0x678bb5e0 <+140540>:\tlea (%eax,%ecx,1),%ecx\n"
>~" 0x678bb5e3 <+140543>:\tmov %ecx,%eax\n"
>~" 0x678bb5e5 <+140545>:\tsar $0x8,%eax\n"
>~" 0x678bb5e8 <+140548>:\tlea 0x80(%ecx,%eax,1),%edx\n"
>~" 0x678bb5ef <+140555>:\tsar $0x8,%edx\n"
>~" 0x678bb5f2 <+140558>:\tmov %esi,(%esp)\n"
>~" 0x678bb5f5 <+140561>:\tmov %edx,-0x58(%ebp)\n"
>~" 0x678bb5f8 <+140564>:\tcall 0x67d1d7c8 <Z6qGreenj>\n"
>~" 0x678bb5fd <+140569>:\tmov -0x20(%ebp),%esi\n"
>~" 0x678bb600 <+140572>:\timul %eax,%esi\n"
>~" 0x678bb603 <+140575>:\tmov -0x10(%ebp),%ecx\n"
>~" 0x678bb606 <+140578>:\timul -0x34(%ebp),%ecx\n"
>~" 0x678bb60a <+140582>:\tlea (%esi,%ecx,1),%ecx\n"
>~" 0x678bb60d <+140585>:\tmov -0x1c(%ebp),%esi\n"
>~" 0x678bb610 <+140588>:\tcmp %esi,-0x14(%ebp)\n"
>~" 0x678bb613 <+140591>:\tmov -0x58(%ebp),%edx\n"
>~" 0x678bb616 <+140594>:\tjg 0x678bb6c0 <ZrsR11QDataStreamR12QPaintBuffer+140764>\n"
>~" 0x678bb61c <+140600>:\tmov %ebx,%esi\n"
>~" 0x678bb61e <+140602>:\tsub %eax,%esi\n"
>~" 0x678bb620 <+140604>:\tmov -0x40(%ebp),%eax\n"
>~" 0x678bb623 <+140607>:\timul %esi,%eax\n"
>~" 0x678bb626 <+140610>:\timul -0x14(%ebp),%ebx\n"
>~" 0x678bb62a <+140614>:\tadd %ebx,%eax\n"
>~" 0x678bb62c <+140616>:\tlea (%eax,%ecx,1),%ecx\n"
>~" 0x678bb62f <+140619>:\tmov %ecx,%eax\n"
>~" 0x678bb631 <+140621>:\tsar $0x8,%eax\n"
>~" 0x678bb634 <+140624>:\tlea 0x80(%ecx,%eax,1),%eax\n"
>~" 0x678bb63b <+140631>:\tsar $0x8,%eax\n"
>~" 0x678bb63e <+140634>:\tmov -0x10(%ebp),%ecx\n"
>~" 0x678bb641 <+140637>:\timul -0x20(%ebp),%ecx\n"
>~" 0x678bb645 <+140641>:\tsar $0x8,%ecx\n"
>~" 0x678bb648 <+140644>:\tmov $0xff,%ebx\n"
>~" 0x678bb64d <+140649>:\tsub %ecx,%ebx\n"
>~" 0x678bb64f <+140651>:\tmov %ebx,0xc(%esp)\n"
>~" 0x678bb653 <+140655>:\tmov %edx,0x8(%esp)\n"
>~" 0x678bb657 <+140659>:\tmov %eax,0x4(%esp)\n"
>~" 0x678bb65b <+140663>:\tmov -0x18(%ebp),%esi\n"
>~" 0x678bb65e <+140666>:\tmov %esi,(%esp)\n"
>~" 0x678bb661 <+140669>:\tcall 0x67d1d6f0 <Z5qRgbaiiii>\n"
>~" 0x678bb666 <+140674>:\tmov -0x24(%ebp),%edx\n"
>~" 0x678bb669 <+140677>:\tmov %eax,(%edx,%edi,4)\n"
>~" 0x678bb66c <+140680>:\tinc %edi\n"
>~" 0x678bb66d <+140681>:\tcmp -0x3c(%ebp),%edi\n"
>~" 0x678bb670 <+140684>:\tje 0x678bb500 <ZrsR11QDataStreamR12QPaintBuffer+140316>\n"
>~" 0x678bb676 <+140690>:\tmov -0x24(%ebp),%eax\n"
>~" 0x678bb679 <+140693>:\tmov (%eax,%edi,4),%esi\n"
>~" 0x678bb67c <+140696>:\tmov %esi,(%esp)\n"
>~" 0x678bb67f <+140699>:\tcall 0x67d1d7bc <Z6qAlphaj>\n"
>~" 0x678bb684 <+140704>:\tmov %eax,%ebx\n"
>~" 0x678bb686 <+140706>:\tmov %esi,(%esp)\n"
>~" 0x678bb689 <+140709>:\tcall 0x67d1d630 <Z4qRedj>\n"
>~" 0x678bb68e <+140714>:\tmov $0xff,%edx\n"
>~" 0x678bb693 <+140719>:\tsub %ebx,%edx\n"
>~" 0x678bb695 <+140721>:\tmov %edx,-0x10(%ebp)\n"
>~" 0x678bb698 <+140724>:\tmov -0x30(%ebp),%ecx\n"
>~" 0x678bb69b <+140727>:\timul %edx,%ecx\n"
>~" 0x678bb69e <+140730>:\tmov -0x20(%ebp),%edx\n"
>~" 0x678bb6a1 <+140733>:\timul %eax,%edx\n"
>~" 0x678bb6a4 <+140736>:\tlea (%ecx,%edx,1),%edx\n"
>~" 0x678bb6a7 <+140739>:\tmov -0x2c(%ebp),%ecx\n"
>~" 0x678bb6aa <+140742>:\tcmp %ecx,-0x14(%ebp)\n"
>~" 0x678bb6ad <+140745>:\tjle 0x678bb584 <ZrsR11QDataStreamR12QPaintBuffer+140448>\n"
>~" 0x678bb6b3 <+140751>:\timul %ecx,%eax\n"
>~" 0x678bb6b6 <+140754>:\tadd %eax,%edx\n"
>~" 0x678bb6b8 <+140756>:\tjmp 0x678bb599 <ZrsR11QDataStreamR12QPaintBuffer+140469>\n"
I see QPaintBuffer. Can crash cause overflow QPaintBuffer?
If can: what can i do?

wysota
18th October 2012, 15:32
Please prepare a minimal compilable example reproducing the problem.

Viper666
18th October 2012, 17:00
Widget.h

#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QtGui>
#include <QtCore>
#include <QtWebKit>

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
Q_OBJECT

public:
explicit Widget(QWidget *parent = 0);
~Widget();

private slots:
void loadStarted();
void loadFinished(bool ok);
void load(int progress);

private:
Ui::Widget *ui;
QVBoxLayout *layout;
QWebView *view;
QStatusBar *statusbar;
QProgressBar *bar;
};

#endif // WIDGET_H

widget.cpp

#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
layout = new QVBoxLayout(this);
this->setLayout(layout);
view = new QWebView(this);
layout->addWidget(view);
statusbar = new QStatusBar(this);
layout->addWidget(statusbar);
bar = new QProgressBar(this);
statusbar->addPermanentWidget(bar);
view->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
view->load(QUrl("http://google.com"));
connect(view, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
connect(view, SIGNAL(loadProgress(int)), this, SLOT(load(int)));
}

Widget::~Widget()
{
delete ui;
}

void Widget::loadStarted()
{
bar->setVisible(true);
}

void Widget::loadFinished(bool ok)
{
bar->setVisible(false);
}

void Widget::load(int progress)
{
bar->setValue(progress);
}


Added after 40 minutes:

go google maps type for example washington DC and drag market and wait it will crash program

Viper666
18th October 2012, 19:19
Video : http://www.youtube.com/watch?v=TdSb6FEde0o

ChrisW67
18th October 2012, 23:23
After cutting out the (unused) Designer UI stuff the program does not fail here.

Viper666
19th October 2012, 13:13
Widget.h

#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QtGui>
#include <QtCore>
#include <QtWebKit>



class Widget : public QWidget
{
Q_OBJECT

public:
explicit Widget(QWidget *parent = 0);
~Widget();

private slots:
void loadStarted();
void loadFinished(bool ok);
void load(int progress);

private:
// Ui::Widget *ui;
QVBoxLayout *layout;
QWebView *view;
QStatusBar *statusbar;
QProgressBar *bar;
};

#endif // WIDGET_H

Widget.cpp

#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
QWidget(parent)
//ui(new Ui::Widget)
{
// ui->setupUi(this);
layout = new QVBoxLayout(this);
this->setLayout(layout);
view = new QWebView(this);
layout->addWidget(view);
statusbar = new QStatusBar(this);
layout->addWidget(statusbar);
bar = new QProgressBar(this);
statusbar->addPermanentWidget(bar);
view->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
view->load(QUrl("http://google.com"));
connect(view, SIGNAL(loadStarted()), this, SLOT(loadStarted()));
connect(view, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
connect(view, SIGNAL(loadProgress(int)), this, SLOT(load(int)));
}

Widget::~Widget()
{
//delete ui;
}

void Widget::loadStarted()
{
bar->setVisible(true);
}

void Widget::loadFinished(bool ok)
{
bar->setVisible(false);
}

void Widget::load(int progress)
{
bar->setValue(progress);
}

Ok i deleted it. prigram is crashed still

ChrisW67
20th October 2012, 05:30
Remove any plugins from the equation

Viper666
20th October 2012, 11:24
I don't quite understand what i must remove please example or thing that i must remove

wysota
20th October 2012, 12:03
I don't quite understand what i must remove please example or thing that i must remove


view->settings()->setAttribute(QWebSettings::PluginsEnabled, true);

Viper666
20th October 2012, 12:39
but now google mpas won't work and any flash app/pages too

wysota
20th October 2012, 13:45
Google Maps doesn't require any plugins.

As for "other apps", we're not dealing with "other apps" right now so let's isolate the problem with a minimalistic environment (e.g. let's reduce the possibility of a broken plugin kicking in and crashing your app).