Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

Crash application during call JavaScript function from Flash Player

$
0
0
Hi all. Crash application during call JavaScript function (with 2-3th times) from Flash Player Run debugger: SIGSEGV (Segmentation fault) last stack – Cannot access memory at address 0×0 else stack – Cannot access memory at address 0xbaadf00d In Firefox, Chrome – all good works! OS: Windows XP x32 Pro SP3. Qt: 4.8.4 MinGW: 4.4 IDE: 7.2.1. FlashPlayer: 11.5.502.110 (debug version) main.cpp #include <QApplication> #include <QLocale> #include <QTextCodec> #include <QWebSettings>   #include "TestBrowser.h"   int main(int argc,char *argv[]){     QApplication a(argc,argv);     QWebSettings *ws=QWebSettings::globalSettings();     ws->setAttribute(QWebSettings::PluginsEnabled,true);     ws->setAttribute(QWebSettings::JavascriptEnabled,true);     ws->setAttribute(QWebSettings::JavaEnabled,true);     ws->setAttribute(QWebSettings::JavascriptCanOpenWindows,true);     ws->setAttribute(QWebSettings::JavascriptCanCloseWindows,true);     ws->setAttribute(QWebSettings::JavascriptCanAccessClipboard,true);     ws->setAttribute(QWebSettings::SpatialNavigationEnabled,true);     ws->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled,true);     ws->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled,true);     ws->setAttribute(QWebSettings::LocalStorageEnabled,true);     ws->setAttribute(QWebSettings::PrintElementBackgrounds,false);     ws->setAttribute(QWebSettings::DeveloperExtrasEnabled,true);     QLocale::setDefault(QLocale(QLocale::Russian,QLocale::RussianFederation));     QTextCodec *utfcodec=QTextCodec::codecForName("UTF-8");     QTextCodec::setCodecForTr(utfcodec);     QTextCodec::setCodecForCStrings(utfcodec);         TestBrowser *mw = new TestBrowser();     mw->setWindowIcon(QIcon("favicon.ico"));     mw->resize(1060,800);     mw->move(40,0);     mw->show();         return a.exec(); } TestBrowser.h #ifndef TESTBROWSER_H #define TESTBROWSER_H   #include <QApplication> #include <QMainWindow> #include <QObject> #include <QLineEdit> #include <QToolBar> #include <QPushButton> #include <QMessageBox> #include <QPrintPreviewDialog> #include <QPrinter> #include <QWebView> #include <QWebFrame> #include <QUrl>   class TestBrowser : public QMainWindow{ Q_OBJECT public:     TestBrowser();     QString tp;     QWebView *view;     QLineEdit *locationEdit;     void doAlertPan(QString me);   public slots:     void changeLocation();     void toTestPage();     void doPrint(QWebFrame * fr);         };   #endif TestBrowser.cpp #include "TestBrowser.h"   TestBrowser::TestBrowser(){     tp="http://ifinterface.com/techtest/testprint.html";     view=new QWebView(this);     view->page()->setForwardUnsupportedContent(true);     view->page()->createStandardContextMenu();       locationEdit=new QLineEdit(this);     locationEdit->setSizePolicy(QSizePolicy::Expanding,locationEdit->sizePolicy().verticalPolicy());         QToolBar *toolBar=addToolBar("Navigation");     toolBar->addAction(view->pageAction(QWebPage::Back));     toolBar->addAction(view->pageAction(QWebPage::Forward));     toolBar->addAction(view->pageAction(QWebPage::Reload));     toolBar->addAction(view->pageAction(QWebPage::Stop));     QPushButton *b1=new QPushButton("to TestPage",this);     toolBar->addWidget(b1);     toolBar->addWidget(locationEdit);     QPushButton *b2=new QPushButton("=>",this);     toolBar->addWidget(b2);         connect(view->page(),SIGNAL(printRequested(QWebFrame *)),this,SLOT(doPrint(QWebFrame *)));     connect(b1,SIGNAL(clicked()),this,SLOT(toTestPage()));     connect(b2,SIGNAL(clicked()),SLOT(changeLocation()));     connect(locationEdit,SIGNAL(returnPressed()),SLOT(changeLocation()));         locationEdit->setText(tp);     view->load(QUrl(tp));         setCentralWidget(view); }   void TestBrowser::doAlertPan(QString me){     QMessageBox msgBox;     msgBox.setWindowIcon(QIcon("favicon.ico"));     msgBox.setIcon(QMessageBox::Information);     msgBox.setWindowTitle(tr("WebPage :: Сообщение"));     msgBox.setText(me);     msgBox.exec(); }   void TestBrowser::toTestPage(){     locationEdit->setText(tp);     view->load(QUrl(tp));     view->setFocus(); }   void TestBrowser::doPrint(QWebFrame * fr){     QPrintPreviewDialog* dialog=new QPrintPreviewDialog(this);     dialog->resize(800, 750);     connect(dialog,SIGNAL(paintRequested(QPrinter*)),fr,SLOT(print(QPrinter*)));     dialog->exec();     dialog->deleteLater(); }   void TestBrowser::changeLocation(){     QUrl url=QUrl(locationEdit->text());     view->load(url);     view->setFocus(); } Most asked to point a finger that is not so. If you have any thoughts / ideas – I will be glad to know.

Viewing all articles
Browse latest Browse all 18427

Latest Images

Trending Articles



Latest Images