+ Reply to Thread
Results 1 to 1 of 1

Thread: QScroller crash after deleting QListWidget on Android

  1. #1
    Join Date
    Jul 2018
    Posts
    1
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Android

    Default QScroller crash after deleting QListWidget on Android

    To test QScroller on my Android device,
    I have written a simple HelloWorld-like application with QStackedWidget with 2 pages.
    Every page has a single QListWidget with a number of items.
    On startup, the app shows page_2 of the stacked widget with a number of items. QScroller is attached programmatically to this QListWidget:

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. ui->setupUi(this);
    6.  
    7. ui->stackedWidget->setCurrentIndex(1);
    8.  
    9. scroller = QScroller::scroller(ui->listWidget_2);
    10. scroller->grabGesture(ui->listWidget_2);
    11. }
    To copy to clipboard, switch view to plain text mode 

    On application startup everything is ok. QScroller attached is working fine with the QListWidget.

    After that I press "Go to page 1" button which removes the entire page from the stacked widget and attach QScroller to the second QListWidget :

    Qt Code:
    1. void MainWindow::on_pushButton_clicked()
    2. {
    3. QScroller::ungrabGesture(ui->listWidget_2);
    4.  
    5. ui->stackedWidget->removeWidget(ui->page_2);
    6. ui->page_2->deleteLater();
    7. ui->page_2 = nullptr;
    8.  
    9. QScroller* scroller2 = QScroller::scroller(ui->listWidget);
    10. scroller2->grabGesture(ui->listWidget);
    11. }
    To copy to clipboard, switch view to plain text mode 

    The widget is displayed OK. But when I try to scroll it with my fingers, the app crashes with SIGSEGV(Segmentation fault) and the stack is:

    #10 qtMainLoopThread
    1. QWidget* object_cast<QWidget*>(QObject*)
    2. QFlickGestureRecognizer::recognize(QGesture*, QObject*, QEvent*)
    3. ???

    What am i doing wrong???

    The complete source code of the application is attached
    Attached Files Attached Files

+ Reply to Thread

Similar Threads

  1. QSqlsocket crash when deleting
    By Higestromm in forum Qt Programming
    Replies: 4
    Last Post: 25th April 2017, 14:48
  2. QScroller choppy animation on Android
    By Andre92 in forum Newbie
    Replies: 2
    Last Post: 21st March 2015, 14:13
  3. Replies: 2
    Last Post: 16th October 2011, 23:25
  4. Replies: 3
    Last Post: 21st July 2010, 07:40
  5. Deleting Class causes app crash
    By been_1990 in forum Qt Programming
    Replies: 8
    Last Post: 29th January 2010, 17:52

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts