Results 1 to 2 of 2

Thread: QGraphicsProxyWidget usage leads to QApplication destructor crashing

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2021
    Thanked 1 Time in 1 Post
    Qt products
    Unix/X11 Windows Android

    Question QGraphicsProxyWidget usage leads to QApplication destructor crashing

    Recently I needed to insert several buttons into QGraphicsScene and implemented it as it was described in Qt examples (I use Qt 5.15.2):
    Qt Code:
    1. QMyWidget* widget;
    2. // ...
    3. // initializing widget, adding layout, adding 3 QPushButton’s to this layout
    4. QMyGraphicsScene* scene;
    5. // initializing some my scene
    6. QGraphicsProxyWidget* proxy = scene->addWidget (widget);
    To copy to clipboard, switch view to plain text mode 
    Everything works fine, aside from a mysterious crash happening on the application exit. The crash appears on Linux and Android (not observed on Windows) deep in QApplication destructor.
    What is very interesting, the crash happens only in the case, if any of the buttons present in the QGraphicsProxyWidget, was pressed during execution. If the application is started, then closed immediately without any user interaction with the buttons, - there is no crash!

    During this problem investigation, I added full cleanup that is performed when just one my QMainWindow inheritor is closed:
    Qt Code:
    1. proxy->setWidget (nullptr);
    2. scene->removeItem (proxy);
    3. delete proxy;
    To copy to clipboard, switch view to plain text mode 
    But this doesn’t help, and when all QWidget’s and QGraphicsScene are already destroyed, the crash still happens in QApplication::~QApplication.
    Any help with this issue would be appreciated.
    Last edited by redsoft; 25th June 2022 at 19:11.

Similar Threads

  1. Replies: 1
    Last Post: 15th September 2021, 18:32
  2. Serializing a QHash leads to SEGFault
    By gbonnema in forum Newbie
    Replies: 10
    Last Post: 7th January 2015, 19:00
  3. Replies: 0
    Last Post: 14th May 2014, 12:23
  4. Crashing without debug mode- No crashing with gdb debugger
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 1
    Last Post: 7th February 2011, 12:27
  5. Replies: 4
    Last Post: 1st December 2008, 12:13

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.