Project

General

Profile

Actions

Bug #1644

closed

crash in WApplication::instance()->session()->renderer().needUpdate(this, laterOnly) when invoked item->setData(boost::any(id), Wt::UserRole); ==> crash here

Added by navnidhi sharma almost 12 years ago. Updated almost 12 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
01/28/2013
Due date:
% Done:

0%

Estimated time:

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){

if (iCol >= model
columnCount() && iRow 0) {
model->insertColumns(model->columnCount(), iCol + 1 - model->columnCount());
model->setHeaderData(iCol, boost::any(Wt::WString::fromUTF8(x->first)));
}
if (iCol 0 && iRow >= model>rowCount()) {

model
insertRows(model>rowCount(), iRow + 1 - model->rowCount());

}

model
setData(iRow, iCol, boost::any(x>second));

iCol;

ss << x
first << "=" << x>second << ",";

}

Wt::WStandardItem* item = model->item(iRow, iId);

item
setFlags(item~~>flags() | Wt::ItemIsDragEnabled);

item->setIcon("css/file.gif");

std::string id = item->text().toUTF8();

item->setData(boost::any(id), Wt::UserRole); ==> crash here

item->setText(id);


Files

wt.png (102 KB) wt.png navnidhi sharma, 01/28/2013 02:43 AM
Actions #1

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

Actions #2

Updated by Koen Deforche almost 12 years ago

  • Status changed from New to Feedback
Actions #3

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

Actions #4

Updated by navnidhi sharma almost 12 years ago

Got it using an example on the web. Thank you for your help

Actions #5

Updated by Koen Deforche almost 12 years ago

  • Status changed from Feedback to Rejected
Actions

Also available in: Atom PDF