Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with QWebView
Forum Updated to NodeBB v4.3 + New Features

Problem with QWebView

Scheduled Pinned Locked Moved Unsolved General and Desktop
18 Posts 4 Posters 946 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • FakhriF Offline
    FakhriF Offline
    Fakhri
    wrote on last edited by
    #1

    I'm using QWebView in my app, I need to open and close QWebView for several times in special situations. in the first instance, everything is ok! but in the next times, the URL will be loaded but the hyperlinks not work!!! Should I do anything in creating/destroy QWebView? Does anyone have another idea?

    1 Reply Last reply
    0
    • FakhriF Offline
      FakhriF Offline
      Fakhri
      wrote on last edited by
      #2

      More Details:

      I create QApplication and QWebView in my plugin. In fact, I have a plugin that open/close several times. I think the problem is here.

      1 Reply Last reply
      0
      • FakhriF Offline
        FakhriF Offline
        Fakhri
        wrote on last edited by
        #3

        Re: Problem with QWebView

        Guys! How can I create two QWebView instance for showing two different url? Assume you have two buttons that each of them should open a url in a specific QWebView. The second url load with some problems always.

        jsulmJ 1 Reply Last reply
        0
        • FakhriF Fakhri

          Re: Problem with QWebView

          Guys! How can I create two QWebView instance for showing two different url? Assume you have two buttons that each of them should open a url in a specific QWebView. The second url load with some problems always.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Fakhri said in Problem with QWebView:

          The second url load with some problems always

          You should say what problems and show the code where you do this.
          You create second QWebView in the same way you create the first one.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          FakhriF 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Fakhri said in Problem with QWebView:

            The second url load with some problems always

            You should say what problems and show the code where you do this.
            You create second QWebView in the same way you create the first one.

            FakhriF Offline
            FakhriF Offline
            Fakhri
            wrote on last edited by Fakhri
            #5

            @jsulm Thanks for your reply.

            This is a sample code:

            int main(int argc, char *argv[]) {
                QApplication app(argc, argv);
                QUrl url("https://google.com");
                QWebView view1;
                view1.load(url);
                view1.show();
                app.exec();
             
                QWebView view2;
                view2.load(url);
                view2.show();
                return app.exec();    
            }
            

            As I said in the previous posts, I'm using the QWebView in a plugin, and since the QApplication is a singleton object, I simulate my codes with the above codes. In fact, I have a plugin that I should open a QWebView and load url in it, close it and again I can open it, load url and .... Only for the first time the url will be loaded without problem. Why? and How can I handle this issue in a plugin?

            jsulmJ 1 Reply Last reply
            0
            • FakhriF Offline
              FakhriF Offline
              Fakhri
              wrote on last edited by
              #6

              I found a post with a similar problem here:
              https://forum.qt.io/topic/13855/calling-qapplication-exec-multiple-times-in-loop-is-possible-if-yes-how

              JoeCFDJ 1 Reply Last reply
              0
              • FakhriF Fakhri

                I found a post with a similar problem here:
                https://forum.qt.io/topic/13855/calling-qapplication-exec-multiple-times-in-loop-is-possible-if-yes-how

                JoeCFDJ Offline
                JoeCFDJ Offline
                JoeCFD
                wrote on last edited by
                #7

                @Fakhri int main(int argc, char *argv[]) {
                QApplication app(argc, argv);
                QUrl url("https://google.com");
                QWebView view1;
                view1.load(url);
                view1.show();

                QWebView view2;
                view2.load(url);
                view2.show();
                return app.exec();    
                

                }

                why do you need to call app.exec() twice?

                FakhriF 1 Reply Last reply
                1
                • JoeCFDJ JoeCFD

                  @Fakhri int main(int argc, char *argv[]) {
                  QApplication app(argc, argv);
                  QUrl url("https://google.com");
                  QWebView view1;
                  view1.load(url);
                  view1.show();

                  QWebView view2;
                  view2.load(url);
                  view2.show();
                  return app.exec();    
                  

                  }

                  why do you need to call app.exec() twice?

                  FakhriF Offline
                  FakhriF Offline
                  Fakhri
                  wrote on last edited by
                  #8

                  @JoeCFD Like the following post, I need to run qapplication several times in a plugin and load a url. This code simulates it.

                  https://forum.qt.io/topic/13855/calling-qapplication-exec-multiple-times-in-loop-is-possible-if-yes-how

                  1 Reply Last reply
                  0
                  • FakhriF Fakhri

                    @jsulm Thanks for your reply.

                    This is a sample code:

                    int main(int argc, char *argv[]) {
                        QApplication app(argc, argv);
                        QUrl url("https://google.com");
                        QWebView view1;
                        view1.load(url);
                        view1.show();
                        app.exec();
                     
                        QWebView view2;
                        view2.load(url);
                        view2.show();
                        return app.exec();    
                    }
                    

                    As I said in the previous posts, I'm using the QWebView in a plugin, and since the QApplication is a singleton object, I simulate my codes with the above codes. In fact, I have a plugin that I should open a QWebView and load url in it, close it and again I can open it, load url and .... Only for the first time the url will be loaded without problem. Why? and How can I handle this issue in a plugin?

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by jsulm
                    #9

                    @Fakhri Remove first app.exec()!

                    int main(int argc, char *argv[]) {
                        QApplication app(argc, argv);
                        QUrl url("https://google.com");
                        QWebView view1;
                        view1.load(url);
                        view1.show();
                     
                        QWebView view2;
                        view2.load(url);
                        view2.show();
                        return app.exec();    
                    }
                    

                    "I need to run qapplication several times in a plugin and load a url" - there is no need to call app.exec() twice to do that! I app.exec() must be called only once.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    FakhriF 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @Fakhri Remove first app.exec()!

                      int main(int argc, char *argv[]) {
                          QApplication app(argc, argv);
                          QUrl url("https://google.com");
                          QWebView view1;
                          view1.load(url);
                          view1.show();
                       
                          QWebView view2;
                          view2.load(url);
                          view2.show();
                          return app.exec();    
                      }
                      

                      "I need to run qapplication several times in a plugin and load a url" - there is no need to call app.exec() twice to do that! I app.exec() must be called only once.

                      FakhriF Offline
                      FakhriF Offline
                      Fakhri
                      wrote on last edited by
                      #10

                      @jsulm first of all thank you for your reply.

                      I have a C++ (non QT) application. It can load plugins with specific structure. I developed a plugin with qt for it. In my plugin I have a method that should create a qtapplication and load a url with a QWebview. So please note that this method will be called several times. In the first time the url will be loaded without any problem. But after that, the url will be loaded but some hyperlink (buttons) not act correctly.

                      In fact, the main that I attached isn't the real code, but it's a scenario that occurred in my application.

                      This is real scenario:

                      • Start C++(non qt)
                      • Loading the plugins
                      • Calling the method inside the plugin
                        • qapplication
                        • qwebview
                        • load url
                        • app.exec
                        • ...
                        • close
                          ....
                      • Calling the method inside the plugin
                        • qapplication
                        • qwebview
                        • load url
                        • app.exec
                        • url won't be loaded correctly
                      jsulmJ 1 Reply Last reply
                      0
                      • FakhriF Fakhri

                        @jsulm first of all thank you for your reply.

                        I have a C++ (non QT) application. It can load plugins with specific structure. I developed a plugin with qt for it. In my plugin I have a method that should create a qtapplication and load a url with a QWebview. So please note that this method will be called several times. In the first time the url will be loaded without any problem. But after that, the url will be loaded but some hyperlink (buttons) not act correctly.

                        In fact, the main that I attached isn't the real code, but it's a scenario that occurred in my application.

                        This is real scenario:

                        • Start C++(non qt)
                        • Loading the plugins
                        • Calling the method inside the plugin
                          • qapplication
                          • qwebview
                          • load url
                          • app.exec
                          • ...
                          • close
                            ....
                        • Calling the method inside the plugin
                          • qapplication
                          • qwebview
                          • load url
                          • app.exec
                          • url won't be loaded correctly
                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @Fakhri Well, then you have to exit the event loop before loading second qwebview.
                        To exit event loop call https://doc.qt.io/qt-5/qcoreapplication.html#exit
                        And read this: https://doc.qt.io/qt-5/qcoreapplication.html#exit
                        "After this function has been called, the application leaves the main event loop and returns from the call to exec(). The exec() function returns returnCode. If the event loop is not running, this function does nothing."

                        https://forum.qt.io/topic/113070/qt-code-of-conduct

                        FakhriF 1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @Fakhri Well, then you have to exit the event loop before loading second qwebview.
                          To exit event loop call https://doc.qt.io/qt-5/qcoreapplication.html#exit
                          And read this: https://doc.qt.io/qt-5/qcoreapplication.html#exit
                          "After this function has been called, the application leaves the main event loop and returns from the call to exec(). The exec() function returns returnCode. If the event loop is not running, this function does nothing."

                          FakhriF Offline
                          FakhriF Offline
                          Fakhri
                          wrote on last edited by Fakhri
                          #12

                          @jsulm This is my method in the plugin:

                          int foo(QUrl url) {
                          
                              AuthResult OAuth::authorize(Provider *provider){
                                  AuthResult result;
                                  int argc=1;
                                  char **argv=nullptr;
                                  QApplication app(argc, argv);
                                  QCoreApplication::exit();
                                  QWebView view;
                                  view.load(url);
                                  view.show();
                                  return app.exec();
                          }
                          

                          For the first time is ok, but in the second time it has segmentation fault in app.exec(). This is the backtrace with gdb:

                          #0  0x00007fffef90e4d6 in ?? ()
                             from /gnu/store/rhwni6dl3qzsp5haq374kqjl2kg3vm9a-qt-5.11.3/lib/qt5/plugins/platforms/../../../libQt5XcbQpa.so.5
                          #1  0x00007ffff3e851b3 in ?? () from /home/panther/.guix-profile/lib/libQt5Gui.so.5
                          #2  0x00007ffff3e858f9 in QPainter::drawGlyphRun(QPointF const&, QGlyphRun const&) ()
                             from /home/panther/.guix-profile/lib/libQt5Gui.so.5
                          #3  0x00007ffff62a75e6 in WebCore::drawQtGlyphRun(WebCore::GraphicsContext&, QGlyphRun const&, QPointF const&, double) [clone .constprop.48] () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #4  0x00007ffff62a7e23 in WebCore::FontCascade::drawGlyphs(WebCore::GraphicsContext&, WebCore::Font const&, WebCore::GlyphBuffer const&, int, int, WebCore::FloatPoint const&, WebCore::FontSmoothingMode) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #5  0x00007ffff6179e0b in WebCore::FontCascade::drawGlyphBuffer(WebCore::GraphicsContext&, WebCore::TextRun const&, WebCore::GlyphBuffer const&, WebCore::FloatPoint&) const () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #6  0x00007ffff617a185 in WebCore::FontCascade::drawText(WebCore::GraphicsContext&, WebCore::TextRun const&, WebCore::FloatPoint const&, int, int, WebCore::FontCascade::CustomFontNotReadyAction) const ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #7  0x00007ffff618861e in WebCore::GraphicsContext::drawText(WebCore::FontCascade const&, WebCore::TextRun const&, WebCore::FloatPoint const&, int, int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #8  0x00007ffff5a147ad in WebCore::TextPainter::drawTextOrEmphasisMarks(WebCore::FontCascade const&, WebCore::TextRun const&, WTF::AtomicString const&, int, WebCore::FloatPoint const&, int, int) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #9  0x00007ffff5a149da in WebCore::TextPainter::paintTextWithShadows(WebCore::ShadowData const*, WebCore::FontCascade const&, WebCore::TextRun const&, WebCore::FloatRect const&, WebCore::FloatPoint const&, int, int, WTF::AtomicString const&, int, bool) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #10 0x00007ffff5a14a90 in WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded(WebCore::TextRun const&, WebCore::FloatRect const&, WebCore::FloatPoint const&, int, int, WebCore::TextPaintStyle const&, WebCore::ShadowData const*) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #11 0x00007ffff5a14fd5 in WebCore::TextPainter::paintText(WebCore::TextRun const&, int, WebCore::FloatRect const&, WebCore::FloatPoint const&, int, int, bool, bool) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #12 0x00007ffff5a9d13a in WebCore::SimpleLineLayout::paintFlow(WebCore::RenderBlockFlow const&, WebCore::SimpleLineLayou--Type <RET> for more, q to quit, c to continue without paging--
                          t::Layout const&, WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #13 0x00007ffff59bf7a1 in WebCore::RenderBlock::paintContents(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #14 0x00007ffff5ac7d12 in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #15 0x00007ffff5ae191d in WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #16 0x00007ffff59cc203 in WebCore::RenderElement::paintAsInlineBlock(WebCore::PaintInfo&, WebCore::LayoutPoint const&)
                              () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #17 0x00007ffff59f9d14 in WebCore::InlineElementBox::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::LayoutUnit, WebCore::LayoutUnit) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #18 0x00007ffff5ae7935 in WebCore::InlineFlowBox::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::LayoutUnit, WebCore::LayoutUnit) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #19 0x00007ffff5ae7b24 in WebCore::RootInlineBox::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::LayoutUnit, WebCore::LayoutUnit) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #20 0x00007ffff5ac3978 in WebCore::RenderLineBoxList::paint(WebCore::RenderBoxModelObject*, WebCore::PaintInfo&, WebCore::LayoutPoint const&) const () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #21 0x00007ffff59bf7a1 in WebCore::RenderBlock::paintContents(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #22 0x00007ffff5ac7d12 in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #23 0x00007ffff5ae191d in WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #24 0x00007ffff59c216c in WebCore::RenderBlockFlow::paintFloats(WebCore::PaintInfo&, WebCore::LayoutPoint const&, bool)
                              () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #25 0x00007ffff5ac7f55 in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #26 0x00007ffff5ae191d in WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                          --Type <RET> for more, q to quit, c to continue without paging--
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #27 0x00007ffff59cc479 in WebCore::RenderBlock::paintChild(WebCore::RenderBox&, WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::PaintInfo&, bool, WebCore::RenderBlock::PaintBlockType) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #28 0x00007ffff59cc6e6 in WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::PaintInfo&, bool) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #29 0x00007ffff59bf77b in WebCore::RenderBlock::paintContents(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #30 0x00007ffff5ac7d12 in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #31 0x00007ffff5ae191d in WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #32 0x00007ffff5a34d6d in WebCore::RenderLayer::paintForegroundForFragmentsWithPhase(WebCore::PaintPhase, WTF::Vector<WebCore::LayerFragment, 1ul, WTF::CrashOnOverflow, 16ul> const&, WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int, WebCore::RenderObject*) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #33 0x00007ffff5acbf9c in WebCore::RenderLayer::paintForegroundForFragments(WTF::Vector<WebCore::LayerFragment, 1ul, WTF::CrashOnOverflow, 16ul> const&, WebCore::GraphicsContext&, WebCore::GraphicsContext&, WebCore::LayoutRect const&, bool, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int, WebCore::RenderObject*, bool) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #34 0x00007ffff5ae31cd in WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #35 0x00007ffff5ae4000 in WebCore::RenderLayer::paintLayer(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #36 0x00007ffff5aea6e5 in WebCore::RenderLayer::paintList(WTF::Vector<WebCore::RenderLayer*, 0ul, WTF::CrashOnOverflow, 16ul>*, WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #37 0x00007ffff5ae2fcf in WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #38 0x00007ffff5ae4000 in WebCore::RenderLayer::paintLayer(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintin--Type <RET> for more, q to quit, c to continue without paging--
                          gInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #39 0x00007ffff5aea6e5 in WebCore::RenderLayer::paintList(WTF::Vector<WebCore::RenderLayer*, 0ul, WTF::CrashOnOverflow, 16ul>*, WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #40 0x00007ffff5ae2fcf in WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #41 0x00007ffff5ae4000 in WebCore::RenderLayer::paintLayer(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #42 0x00007ffff5ae4163 in WebCore::RenderLayer::paint(WebCore::GraphicsContext&, WebCore::LayoutRect const&, WebCore::LayoutSize const&, unsigned int, WebCore::RenderObject*, unsigned int) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #43 0x00007ffff60bf52c in WebCore::FrameView::paintContents(WebCore::GraphicsContext&, WebCore::IntRect const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #44 0x00007ffff50961ef in QWebFrameAdapter::renderRelativeCoords(QPainter*, int, QRegion const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                          #45 0x00007ffff7f3fa8e in QWebFrame::render(QPainter*, QFlags<QWebFrame::RenderLayer>, QRegion const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKitWidgets.so.5
                          #46 0x00007ffff7f3fab1 in QWebFrame::render(QPainter*, QRegion const&) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKitWidgets.so.5
                          #47 0x00007ffff7f4b6fd in QWebView::paintEvent(QPaintEvent*) ()
                             from /home/panther/.guix-profile/lib/libQt5WebKitWidgets.so.5
                          #48 0x00007ffff7a7da88 in QWidget::event(QEvent*) () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                          #49 0x00007ffff7f4c81b in QWebView::event(QEvent*) () from /home/panther/.guix-profile/lib/libQt5WebKitWidgets.so.5
                          #50 0x00007ffff7a4114c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
                             from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                          #51 0x00007ffff7a48280 in QApplication::notify(QObject*, QEvent*) ()
                             from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                          #52 0x00007ffff38b22a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
                             from /home/panther/.guix-profile/lib/libQt5Core.so.5
                          --Type <RET> for more, q to quit, c to continue without paging--
                          #53 0x00007ffff7a7694a in QWidgetPrivate::sendPaintEvent(QRegion const&) ()
                             from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                          #54 0x00007ffff7a77012 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                          #55 0x00007ffff7a5033a in ?? () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                          #56 0x00007ffff7a5057a in ?? () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                          #57 0x00007ffff7a66c0f in QWidgetPrivate::syncBackingStore() () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                          #58 0x00007ffff7a7db90 in QWidget::event(QEvent*) () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                          #59 0x00007ffff7f4c81b in QWebView::event(QEvent*) () from /home/panther/.guix-profile/lib/libQt5WebKitWidgets.so.5
                          #60 0x00007ffff7a4114c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
                             from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                          #61 0x00007ffff7a48280 in QApplication::notify(QObject*, QEvent*) ()
                             from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                          #62 0x00007ffff38b22a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
                             from /home/panther/.guix-profile/lib/libQt5Core.so.5
                          #63 0x00007ffff38b4cdb in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
                             from /home/panther/.guix-profile/lib/libQt5Core.so.5
                          #64 0x00007ffff39063f3 in ?? () from /home/panther/.guix-profile/lib/libQt5Core.so.5
                          #65 0x00007ffff1f14b57 in g_main_context_dispatch ()
                             from /gnu/store/cgy82g6yv8l1chawgch47zh23b0jll3l-glib-2.56.3/lib/libglib-2.0.so.0
                          #66 0x00007ffff1f14d98 in g_main_context_iterate.isra ()
                             from /gnu/store/cgy82g6yv8l1chawgch47zh23b0jll3l-glib-2.56.3/lib/libglib-2.0.so.0
                          #67 0x00007ffff1f14e3c in g_main_context_iteration ()
                             from /gnu/store/cgy82g6yv8l1chawgch47zh23b0jll3l-glib-2.56.3/lib/libglib-2.0.so.0
                          #68 0x00007ffff3905a5f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
                             from /home/panther/.guix-profile/lib/libQt5Core.so.5
                          #69 0x00007fffef9083c1 in ?? ()
                             from /gnu/store/rhwni6dl3qzsp5haq374kqjl2kg3vm9a-qt-5.11.3/lib/qt5/plugins/platforms/../../../libQt5XcbQpa.so.5
                          #70 0x00007ffff38b0bfa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
                          #70 0x00007ffff38b0bfa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
                          --Type <RET> for more, q to quit, c to continue without paging--
                             from /home/panther/.guix-profile/lib/libQt5Core.so.5
                          #71 0x00007ffff38b94f0 in QCoreApplication::exec() () from /home/panther/.guix-profile/lib/libQt5Core.so.5
                          [...]
                          

                          @jsulm @JoeCFD What's your idea?

                          jsulmJ 1 Reply Last reply
                          0
                          • FakhriF Fakhri

                            @jsulm This is my method in the plugin:

                            int foo(QUrl url) {
                            
                                AuthResult OAuth::authorize(Provider *provider){
                                    AuthResult result;
                                    int argc=1;
                                    char **argv=nullptr;
                                    QApplication app(argc, argv);
                                    QCoreApplication::exit();
                                    QWebView view;
                                    view.load(url);
                                    view.show();
                                    return app.exec();
                            }
                            

                            For the first time is ok, but in the second time it has segmentation fault in app.exec(). This is the backtrace with gdb:

                            #0  0x00007fffef90e4d6 in ?? ()
                               from /gnu/store/rhwni6dl3qzsp5haq374kqjl2kg3vm9a-qt-5.11.3/lib/qt5/plugins/platforms/../../../libQt5XcbQpa.so.5
                            #1  0x00007ffff3e851b3 in ?? () from /home/panther/.guix-profile/lib/libQt5Gui.so.5
                            #2  0x00007ffff3e858f9 in QPainter::drawGlyphRun(QPointF const&, QGlyphRun const&) ()
                               from /home/panther/.guix-profile/lib/libQt5Gui.so.5
                            #3  0x00007ffff62a75e6 in WebCore::drawQtGlyphRun(WebCore::GraphicsContext&, QGlyphRun const&, QPointF const&, double) [clone .constprop.48] () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #4  0x00007ffff62a7e23 in WebCore::FontCascade::drawGlyphs(WebCore::GraphicsContext&, WebCore::Font const&, WebCore::GlyphBuffer const&, int, int, WebCore::FloatPoint const&, WebCore::FontSmoothingMode) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #5  0x00007ffff6179e0b in WebCore::FontCascade::drawGlyphBuffer(WebCore::GraphicsContext&, WebCore::TextRun const&, WebCore::GlyphBuffer const&, WebCore::FloatPoint&) const () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #6  0x00007ffff617a185 in WebCore::FontCascade::drawText(WebCore::GraphicsContext&, WebCore::TextRun const&, WebCore::FloatPoint const&, int, int, WebCore::FontCascade::CustomFontNotReadyAction) const ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #7  0x00007ffff618861e in WebCore::GraphicsContext::drawText(WebCore::FontCascade const&, WebCore::TextRun const&, WebCore::FloatPoint const&, int, int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #8  0x00007ffff5a147ad in WebCore::TextPainter::drawTextOrEmphasisMarks(WebCore::FontCascade const&, WebCore::TextRun const&, WTF::AtomicString const&, int, WebCore::FloatPoint const&, int, int) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #9  0x00007ffff5a149da in WebCore::TextPainter::paintTextWithShadows(WebCore::ShadowData const*, WebCore::FontCascade const&, WebCore::TextRun const&, WebCore::FloatRect const&, WebCore::FloatPoint const&, int, int, WTF::AtomicString const&, int, bool) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #10 0x00007ffff5a14a90 in WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded(WebCore::TextRun const&, WebCore::FloatRect const&, WebCore::FloatPoint const&, int, int, WebCore::TextPaintStyle const&, WebCore::ShadowData const*) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #11 0x00007ffff5a14fd5 in WebCore::TextPainter::paintText(WebCore::TextRun const&, int, WebCore::FloatRect const&, WebCore::FloatPoint const&, int, int, bool, bool) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #12 0x00007ffff5a9d13a in WebCore::SimpleLineLayout::paintFlow(WebCore::RenderBlockFlow const&, WebCore::SimpleLineLayou--Type <RET> for more, q to quit, c to continue without paging--
                            t::Layout const&, WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #13 0x00007ffff59bf7a1 in WebCore::RenderBlock::paintContents(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #14 0x00007ffff5ac7d12 in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #15 0x00007ffff5ae191d in WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #16 0x00007ffff59cc203 in WebCore::RenderElement::paintAsInlineBlock(WebCore::PaintInfo&, WebCore::LayoutPoint const&)
                                () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #17 0x00007ffff59f9d14 in WebCore::InlineElementBox::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::LayoutUnit, WebCore::LayoutUnit) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #18 0x00007ffff5ae7935 in WebCore::InlineFlowBox::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::LayoutUnit, WebCore::LayoutUnit) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #19 0x00007ffff5ae7b24 in WebCore::RootInlineBox::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::LayoutUnit, WebCore::LayoutUnit) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #20 0x00007ffff5ac3978 in WebCore::RenderLineBoxList::paint(WebCore::RenderBoxModelObject*, WebCore::PaintInfo&, WebCore::LayoutPoint const&) const () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #21 0x00007ffff59bf7a1 in WebCore::RenderBlock::paintContents(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #22 0x00007ffff5ac7d12 in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #23 0x00007ffff5ae191d in WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #24 0x00007ffff59c216c in WebCore::RenderBlockFlow::paintFloats(WebCore::PaintInfo&, WebCore::LayoutPoint const&, bool)
                                () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #25 0x00007ffff5ac7f55 in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #26 0x00007ffff5ae191d in WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                            --Type <RET> for more, q to quit, c to continue without paging--
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #27 0x00007ffff59cc479 in WebCore::RenderBlock::paintChild(WebCore::RenderBox&, WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::PaintInfo&, bool, WebCore::RenderBlock::PaintBlockType) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #28 0x00007ffff59cc6e6 in WebCore::RenderBlock::paintChildren(WebCore::PaintInfo&, WebCore::LayoutPoint const&, WebCore::PaintInfo&, bool) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #29 0x00007ffff59bf77b in WebCore::RenderBlock::paintContents(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #30 0x00007ffff5ac7d12 in WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #31 0x00007ffff5ae191d in WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #32 0x00007ffff5a34d6d in WebCore::RenderLayer::paintForegroundForFragmentsWithPhase(WebCore::PaintPhase, WTF::Vector<WebCore::LayerFragment, 1ul, WTF::CrashOnOverflow, 16ul> const&, WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int, WebCore::RenderObject*) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #33 0x00007ffff5acbf9c in WebCore::RenderLayer::paintForegroundForFragments(WTF::Vector<WebCore::LayerFragment, 1ul, WTF::CrashOnOverflow, 16ul> const&, WebCore::GraphicsContext&, WebCore::GraphicsContext&, WebCore::LayoutRect const&, bool, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int, WebCore::RenderObject*, bool) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #34 0x00007ffff5ae31cd in WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #35 0x00007ffff5ae4000 in WebCore::RenderLayer::paintLayer(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #36 0x00007ffff5aea6e5 in WebCore::RenderLayer::paintList(WTF::Vector<WebCore::RenderLayer*, 0ul, WTF::CrashOnOverflow, 16ul>*, WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #37 0x00007ffff5ae2fcf in WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #38 0x00007ffff5ae4000 in WebCore::RenderLayer::paintLayer(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintin--Type <RET> for more, q to quit, c to continue without paging--
                            gInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #39 0x00007ffff5aea6e5 in WebCore::RenderLayer::paintList(WTF::Vector<WebCore::RenderLayer*, 0ul, WTF::CrashOnOverflow, 16ul>*, WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #40 0x00007ffff5ae2fcf in WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #41 0x00007ffff5ae4000 in WebCore::RenderLayer::paintLayer(WebCore::GraphicsContext&, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) () from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #42 0x00007ffff5ae4163 in WebCore::RenderLayer::paint(WebCore::GraphicsContext&, WebCore::LayoutRect const&, WebCore::LayoutSize const&, unsigned int, WebCore::RenderObject*, unsigned int) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #43 0x00007ffff60bf52c in WebCore::FrameView::paintContents(WebCore::GraphicsContext&, WebCore::IntRect const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #44 0x00007ffff50961ef in QWebFrameAdapter::renderRelativeCoords(QPainter*, int, QRegion const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKit.so.5
                            #45 0x00007ffff7f3fa8e in QWebFrame::render(QPainter*, QFlags<QWebFrame::RenderLayer>, QRegion const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKitWidgets.so.5
                            #46 0x00007ffff7f3fab1 in QWebFrame::render(QPainter*, QRegion const&) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKitWidgets.so.5
                            #47 0x00007ffff7f4b6fd in QWebView::paintEvent(QPaintEvent*) ()
                               from /home/panther/.guix-profile/lib/libQt5WebKitWidgets.so.5
                            #48 0x00007ffff7a7da88 in QWidget::event(QEvent*) () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                            #49 0x00007ffff7f4c81b in QWebView::event(QEvent*) () from /home/panther/.guix-profile/lib/libQt5WebKitWidgets.so.5
                            #50 0x00007ffff7a4114c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
                               from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                            #51 0x00007ffff7a48280 in QApplication::notify(QObject*, QEvent*) ()
                               from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                            #52 0x00007ffff38b22a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
                               from /home/panther/.guix-profile/lib/libQt5Core.so.5
                            --Type <RET> for more, q to quit, c to continue without paging--
                            #53 0x00007ffff7a7694a in QWidgetPrivate::sendPaintEvent(QRegion const&) ()
                               from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                            #54 0x00007ffff7a77012 in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, int, QPainter*, QWidgetBackingStore*) () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                            #55 0x00007ffff7a5033a in ?? () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                            #56 0x00007ffff7a5057a in ?? () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                            #57 0x00007ffff7a66c0f in QWidgetPrivate::syncBackingStore() () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                            #58 0x00007ffff7a7db90 in QWidget::event(QEvent*) () from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                            #59 0x00007ffff7f4c81b in QWebView::event(QEvent*) () from /home/panther/.guix-profile/lib/libQt5WebKitWidgets.so.5
                            #60 0x00007ffff7a4114c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
                               from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                            #61 0x00007ffff7a48280 in QApplication::notify(QObject*, QEvent*) ()
                               from /home/panther/.guix-profile/lib/libQt5Widgets.so.5
                            #62 0x00007ffff38b22a8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
                               from /home/panther/.guix-profile/lib/libQt5Core.so.5
                            #63 0x00007ffff38b4cdb in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
                               from /home/panther/.guix-profile/lib/libQt5Core.so.5
                            #64 0x00007ffff39063f3 in ?? () from /home/panther/.guix-profile/lib/libQt5Core.so.5
                            #65 0x00007ffff1f14b57 in g_main_context_dispatch ()
                               from /gnu/store/cgy82g6yv8l1chawgch47zh23b0jll3l-glib-2.56.3/lib/libglib-2.0.so.0
                            #66 0x00007ffff1f14d98 in g_main_context_iterate.isra ()
                               from /gnu/store/cgy82g6yv8l1chawgch47zh23b0jll3l-glib-2.56.3/lib/libglib-2.0.so.0
                            #67 0x00007ffff1f14e3c in g_main_context_iteration ()
                               from /gnu/store/cgy82g6yv8l1chawgch47zh23b0jll3l-glib-2.56.3/lib/libglib-2.0.so.0
                            #68 0x00007ffff3905a5f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
                               from /home/panther/.guix-profile/lib/libQt5Core.so.5
                            #69 0x00007fffef9083c1 in ?? ()
                               from /gnu/store/rhwni6dl3qzsp5haq374kqjl2kg3vm9a-qt-5.11.3/lib/qt5/plugins/platforms/../../../libQt5XcbQpa.so.5
                            #70 0x00007ffff38b0bfa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
                            #70 0x00007ffff38b0bfa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
                            --Type <RET> for more, q to quit, c to continue without paging--
                               from /home/panther/.guix-profile/lib/libQt5Core.so.5
                            #71 0x00007ffff38b94f0 in QCoreApplication::exec() () from /home/panther/.guix-profile/lib/libQt5Core.so.5
                            [...]
                            

                            @jsulm @JoeCFD What's your idea?

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            @Fakhri said in Problem with QWebView:

                            QCoreApplication::exit();

                            Why do you call it here?

                            int argc=1;
                            char **argv=nullptr;
                            

                            This is wrong as setting argc to one means that argv contains one element, but it does not in your case as you set the pointer to nullptr.

                            Thing is that you need to call app.exit() at some point. What is the trigger to close first window? Do you show one window after another and not at the same time? Try to use ONE QApplication instance instead of creating one each time.

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            FakhriF 1 Reply Last reply
                            0
                            • jsulmJ jsulm

                              @Fakhri said in Problem with QWebView:

                              QCoreApplication::exit();

                              Why do you call it here?

                              int argc=1;
                              char **argv=nullptr;
                              

                              This is wrong as setting argc to one means that argv contains one element, but it does not in your case as you set the pointer to nullptr.

                              Thing is that you need to call app.exit() at some point. What is the trigger to close first window? Do you show one window after another and not at the same time? Try to use ONE QApplication instance instead of creating one each time.

                              FakhriF Offline
                              FakhriF Offline
                              Fakhri
                              wrote on last edited by
                              #14

                              @jsulm said in Problem with QWebView:

                              This is wrong as setting argc to one means that argv contains one element, but it does not in your case as you set the pointer to nullptr.

                              Yes, you're right. This is a minor bug that isn't my main problem for now. ;)

                              What is the trigger to close first window?

                              The user will close the first window.

                              Do you show one window after another and not at the same time?

                              At the same time? not. After closing the first window, I can call the method inside the plugin and finally open another window.

                              Try to use ONE QApplication instance instead of creating one each time.

                              Since I'm developing a plugin for another application I can't protect this for creating one instance of QApplication.

                              JonBJ 1 Reply Last reply
                              0
                              • FakhriF Fakhri

                                @jsulm said in Problem with QWebView:

                                This is wrong as setting argc to one means that argv contains one element, but it does not in your case as you set the pointer to nullptr.

                                Yes, you're right. This is a minor bug that isn't my main problem for now. ;)

                                What is the trigger to close first window?

                                The user will close the first window.

                                Do you show one window after another and not at the same time?

                                At the same time? not. After closing the first window, I can call the method inside the plugin and finally open another window.

                                Try to use ONE QApplication instance instead of creating one each time.

                                Since I'm developing a plugin for another application I can't protect this for creating one instance of QApplication.

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by
                                #15

                                @Fakhri
                                I don't know if it's relevant, but:

                                        QApplication app(argc, argv);
                                        QCoreApplication::exit();
                                        return app.exec();
                                

                                What is that QCoreApplication::exit() doing/intending to do in that place?

                                FakhriF 1 Reply Last reply
                                0
                                • JonBJ JonB

                                  @Fakhri
                                  I don't know if it's relevant, but:

                                          QApplication app(argc, argv);
                                          QCoreApplication::exit();
                                          return app.exec();
                                  

                                  What is that QCoreApplication::exit() doing/intending to do in that place?

                                  FakhriF Offline
                                  FakhriF Offline
                                  Fakhri
                                  wrote on last edited by
                                  #16

                                  @JonB said in Problem with QWebView:

                                  What is that QCoreApplication::exit() doing/intending to do in that place?

                                  @JonB I should create qapplication several times so I think I should quit from event loop of previous qapplication with it. Please see this post: https://forum.qt.io/post/560665

                                  JonBJ 1 Reply Last reply
                                  0
                                  • FakhriF Fakhri

                                    @JonB said in Problem with QWebView:

                                    What is that QCoreApplication::exit() doing/intending to do in that place?

                                    @JonB I should create qapplication several times so I think I should quit from event loop of previous qapplication with it. Please see this post: https://forum.qt.io/post/560665

                                    JonBJ Offline
                                    JonBJ Offline
                                    JonB
                                    wrote on last edited by JonB
                                    #17

                                    @Fakhri
                                    But what happens when it's called first time and there is no "previous" application to close? How do you know whether it affects the QApplication you have just created? Have you tried temporarily commenting it just to see if there is any effect on your crash?

                                    I admit I know nothing about plugins. But this whole multi-application-exit-exec stuff looks pretty hairy to me....

                                    FakhriF 1 Reply Last reply
                                    0
                                    • JonBJ JonB

                                      @Fakhri
                                      But what happens when it's called first time and there is no "previous" application to close? How do you know whether it affects the QApplication you have just created? Have you tried temporarily commenting it just to see if there is any effect on your crash?

                                      I admit I know nothing about plugins. But this whole multi-application-exit-exec stuff looks pretty hairy to me....

                                      FakhriF Offline
                                      FakhriF Offline
                                      Fakhri
                                      wrote on last edited by
                                      #18

                                      @JonB said in Problem with QWebView:

                                      But what happens when it's called first time and there is no "previous" application to close?

                                      Nothing. Based on the reference: https://doc.qt.io/qt-5/qcoreapplication.html#exit

                                      1 Reply Last reply
                                      0

                                      • Login

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Users
                                      • Groups
                                      • Search
                                      • Get Qt Extensions
                                      • Unsolved