title: QML chartview crash when changing data
body: <p>I'm new to qml and I didn't really get its logic yet.</p>
  
  <p>Here is my issue: I have a chartview with barseries, and I expect that when the user clicks on a bar, the bar chart changes.</p>
  
  <p>So I clear the barSeries and append new data to it. But it causes a segmentation fault.
  If I do the same processing from a button click, it works well. 
  Do you have any idea what is the problem, and how to fix it?</p>
  
  <p>Below is a code sample.</p>
  
  <p>main.qml</p>
  
  <pre><code>import QtQuick 2.7
  import QtQuick.Controls 2.0
  import QtQuick.Layouts 1.0
  
  import QtCharts 2.2
  
  ApplicationWindow {
      visible: true
      width: 640
      height: 480
      title: qsTr("Chartview test")
  
      Item {
          id: histoView
  
          property int globalForJs: 0
  
          anchors.fill: parent
          visible: true
  
          Component.onCompleted: {
              redraw();
          }
  
          signal redrawSignal()
  
          ColumnLayout {
              anchors.fill: parent
              Button {
                  id:myBtn
                  anchors { top: parent.top; left: parent.left; leftMargin: 20 }
                  height: 30
                  width: 80
                  text: "new chart"
                  onClicked: {
                      console.debug("myBtn onClicked")
                      histoView.redrawSignal()
                  }
              }
  
              ChartView {
                  id: chartView
                  anchors { bottom: parent.bottom; left: parent.left; right: parent.right }
                  height: parent.height - 40
  
                  title: "chartview"
  
                  BarSeries {
                      id: mySeries
  
                      axisX: BarCategoryAxis { categories: [" "] }
                      axisY: ValueAxis {
                          id: ordinate
                          min:0
                          max:100
                      }    
  
                      onClicked: {
                          console.debug("mySeries onClicked")
                          histoView.redrawSignal();
                          //myBtn.clicked()
                      }
                  }
              }
          }
  
          function redraw() {
              // clear data
              mySeries.clear();
  
              // add 5 new data
              for (var i=0;i&lt;5;i++) {
                  var tab=[];
                  globalForJs++;
                  tab.push(globalForJs);
                  mySeries.append("tutu"+i,tab);
              }
              // update Y axis maximum value
              if (ordinate.max &lt; globalForJs) {
                  ordinate.max = globalForJs + 10;
              }
          }
  
          onRedrawSignal:redraw()
      }
  }
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>#include &lt;QApplication&gt;
  #include &lt;QQmlApplicationEngine&gt;
  
  int main(int argc, char *argv[])
  {
      QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
      QApplication app(argc, argv);
  
      QQmlApplicationEngine engine;
      engine.load(QUrl(QLatin1String("qrc:/main.qml")));
  
      return app.exec();
  }
  </code></pre>