Important: Please read the Qt Code of Conduct -

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:

    MainWindow::MainWindow(QWidget *parent) :
    ui(new Ui::MainWindow)

    scroller = QScroller::scroller(ui->listWidget_2);


    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 :

    void MainWindow::on_pushButton_clicked()

    ui->page_2 = nullptr;
    QScroller* scroller2 = QScroller::scroller(ui->listWidget);


    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:

Log in to reply