I am trying to use the new Lambda method for a static QTimer call.
C++11 is enabled in the .pro file and I am working with Qt 5.5.1.

I am getting a segfault on line 6 when I try to use the following code snipped.
From my understanding this should generally use references to local variables except for the item pointer.
Since I manipulate the item, the lambda function has to use the mutable keyword.

Qt Code:
  1. void myWidget::modelItemChanged(QStandardItem *item)
  2. {
  3. QBrush brush = item->background();
  4. item->setBackground(Qt::blue);
  5. QTimer::singleShot(1000, [&, item]() mutable {
  6. item->setBackground(brush);
  7. });
  8. }
To copy to clipboard, switch view to plain text mode 

Would appreciate your help.