Bug #1644
closedcrash in WApplication::instance()->session()->renderer().needUpdate(this, laterOnly) when invoked item->setData(boost::any(id), Wt::UserRole); ==> crash here
0%
Description
Hello -
You help will be appreciated. I have the following code/models-
model = new WStandardItemModel(this);
filterModel = new Wt::WSortFilterProxyModel(this);
filterModel ->setSourceModel(model );
filterModel ->setDynamicSortFilter(true);
filterModel ->setFilterKeyColumn(iId);
filterModel ->setFilterRole(Wt::UserRole);
in the code somewhere-
Wt::WTableView* tableView = new Wt::WTableView();
tableView->setAlternatingRowColors(true);
tableView->setModel(filterModel );
Initially, everything is file. I see all the data in the browser. However, when i add the data subsequently to the model using the following code I get the crash initem~~setData(boost::any(id), Wt::UserRole)~~ ¶
int iRow = model->rowCount();
for (auto x = fields~~begin(); x != fields>end(); ++x){columnCount() && iRow 0) {
if (iCol >= model
model->insertColumns(model->columnCount(), iCol + 1 - model->columnCount());
model->setHeaderData(iCol, boost::any(Wt::WString::fromUTF8(x->first)));
}
if (iCol 0 && iRow >= model>rowCount()) {insertRows(model
model>rowCount(), iRow + 1 - model->rowCount());setData(iRow, iCol, boost::any(x
}
model>second));first << "=" << x
iCol;
ss << x>second << ",";setFlags(item~~>flags() | Wt::ItemIsDragEnabled);
}
Wt::WStandardItem* item = model->item(iRow, iId);
item
item->setIcon("css/file.gif");
std::string id = item->text().toUTF8();
item->setData(boost::any(id), Wt::UserRole); ==> crash here
item->setText(id);
Files
Updated by Koen Deforche almost 12 years ago
Hey,
You are probably trying to update the model from outside the event loop ? Then you need to grab the UpdateLock or instead use WServer::post() to deliver the event.
Regards,
koen
Updated by Koen Deforche almost 12 years ago
- Status changed from New to Feedback
Updated by navnidhi sharma almost 12 years ago
Thanks for the quick response. But I could not follow you.
Could you provide the pseudo code? In my opinion the event loop is in main and the model is being updated in the associated class for the form in my app. There are a few such classes and they build and manage the UI and data themselves.
Thx
Updated by navnidhi sharma almost 12 years ago
Got it using an example on the web. Thank you for your help
Updated by Koen Deforche almost 12 years ago
- Status changed from Feedback to Rejected