Feature #902
closedWTreeTable: add a warning for the order of creation (addColumn NEVER AFTER setting setTreeRoot) + do a check so the segmentation fault cannot happen
0%
Description
I sometimes got segmentation faults with the very same stacktrace [see below]. Apparantly it was because of a resize of a certain widget with a ridiculous width (either extremely high, or extremely small).
I traced it down to the treeroot in the code below. Re-arranging the code so the addColumn's happen BEFORE the setTreeNode fixed the issue [which I got in around 10% of the times I tried to reproduce the issue].
I would suggest two things:
- Add a runtime warning when adding columns after the treenode has been set [I know it is allready in the docs, but people as myself clearly missed it slap on my hands]
- Add a runtime check in WLength so you cannot go past the bounds of unitText, and give a warning there as well when this would happen
The problem for a user of your library is finding out what the issue in his code is, because the stacktrace is completely within Wt code.
Code:
WTreeTableNode *root = new file_treetable_node_widget(mount_point_);
setTreeRoot(root, "file");
treeRoot()->setNodeVisible(false);
addColumn("size", 60);
addColumn("modified", 140);
stacktrace:
Wt::WLength::cssText() at WLength.C:119 0xb7c792b3 line std::strcat(buf, unitText[unit*]); next to width, the unit* was also far to big, so it would go past the array and give the segmentation fault
Wt::WWebWidget::updateDom() at WWebWidget.C:1,267 0xb7d68fa5 line element.setProperty(PropertyStyleWidth, width_->cssText());
Wt::WInteractWidget::updateDom() at WInteractWidget.C:325 0xb7c6ea25
Wt::WText::updateDom() at WText.C:115 0xb7d27899
Wt::WWebWidget::createDomElement() at WWebWidget.C:1,780 0xb7d65e2c
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WContainerWidget::createDomChildren() at WContainerWidget.C:721 0xb7c0578d
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:654 0xb7c05eab
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:642 0xb7c05eec
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WContainerWidget::createDomChildren() at WContainerWidget.C:721 0xb7c0578d
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:654 0xb7c05eab
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:642 0xb7c05eec
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WTable::createRow() at WTable.C:327 0xb7d0bfdf
Wt::WTable::createDomElement() at WTable.C:291 0xb7d0c4ac
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WContainerWidget::createDomChildren() at WContainerWidget.C:721 0xb7c0578d
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:654 0xb7c05eab
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:642 0xb7c05eec
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WTable::createRow() at WTable.C:327 0xb7d0bfdf
Wt::WTable::createDomElement() at WTable.C:291 0xb7d0c4ac
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WContainerWidget::createDomChildren() at WContainerWidget.C:721 0xb7c0578d
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:654 0xb7c05eab
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:642 0xb7c05eec
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WContainerWidget::createDomChildren() at WContainerWidget.C:721 0xb7c0578d
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:654 0xb7c05eab
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:642 0xb7c05eec
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::StdWidgetItemImpl::createDomElement() at StdWidgetItemImpl.C:56 0xb7b795da
Wt::StdGridLayoutImpl::createDomElement() at StdGridLayoutImpl.C:482 0xb7b75494
Wt::WContainerWidget::createDomChildren() at WContainerWidget.C:666 0xb7c056d8
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:654 0xb7c05eab
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:642 0xb7c05eec
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WContainerWidget::createDomChildren() at WContainerWidget.C:721 0xb7c0578d
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:654 0xb7c05eab
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:642 0xb7c05eec
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WContainerWidget::createDomChildren() at WContainerWidget.C:721 0xb7c0578d
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:654 0xb7c05eab
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:642 0xb7c05eec
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WContainerWidget::createDomChildren() at WContainerWidget.C:721 0xb7c0578d
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:654 0xb7c05eab
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:642 0xb7c05eec
Wt::WStackedWidget::createDomElement() at WStackedWidget.C:137 0xb7ce2f94
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WContainerWidget::createDomChildren() at WContainerWidget.C:721 0xb7c0578d
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:654 0xb7c05eab
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:642 0xb7c05eec
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WContainerWidget::createDomChildren() at WContainerWidget.C:721 0xb7c0578d
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:654 0xb7c05eab
Wt::WContainerWidget::createDomElement() at WContainerWidget.C:642 0xb7c05eec
Wt::WWebWidget::createActualElement() at WWebWidget.C:1,823 0xb7d6380f
Wt::WWidget::createSDomElement() at WWidget.C:316 0xb7d7948c
Wt::WContainerWidget::updateDomChildren() at WContainerWidget.C:749 0xb7c04872
Wt::WContainerWidget::getDomChanges() at WContainerWidget.C:633 0xb7c05f5f
Wt::WWebWidget::getSDomChanges() at WWebWidget.C:1,683 0xb7d66036
Wt::WebRenderer::collectChanges() at WebRenderer.C:1,286 0xb7deca9c
Wt::WebRenderer::collectJS() at WebRenderer.C:1,367 0xb7dee80e
Wt::WebRenderer::collectJavaScriptUpdate() at WebRenderer.C:1,299 0xb7def1b6
Wt::WebRenderer::collectJavaScript() at WebRenderer.C:536 0xb7df5d17
Wt::WebRenderer::serveJavaScriptUpdate() at WebRenderer.C:459 0xb7df79dd
Wt::WebRenderer::serveResponse() at WebRenderer.C:194 0xb7df8d64
Wt::WebSession::serveResponse() at WebSession.C:1,990 0xb7dda690
Wt::WebSession::render() at WebSession.C:1,945 0xb7de0812
Wt::WebSession::notify() at WebSession.C:1,841 0xb7de3d5a
Wt::WApplication::notify() at WApplication.C:1,358 0xb7bae9a7
Wt::WebSession::handleRequest() at WebSession.C:1,288 0xb7ddda1a
Wt::WebController::handleAsyncRequest() at WebController.C:644 0xb7dfe67f
Wt::WebController::handleRequest() at WebController.C:515 0xb7dff6e4
Wt::WServer::handleRequest() at WServer.C:372 0xb7a23a9a
http::server::WtReply::consumeRequestBody() at WtReply.C:182 0xb7a29d6c
http::server::WtReply::consumeData() at WtReply.C:81 0xb7a2b82c
http::server::RequestParser::parseBody() at RequestParser.C:135 0xb7a0392c
http::server::Connection::handleReadBody() at Connection.C:191 0xb79eb752
http::server::Connection::handleReadRequest0() at Connection.C:127 0xb79eda28
http::server::Connection::handleReadRequest() at Connection.C:162 0xb79edc5a
boost::asio::detail::reactive_socket_recv_op<boost::asio::mutable_buffers_1, boost::_bi::bind_t<void, boost::_mfi::mf2<void, http::server::Connection, boost::system::error_code const&, unsigned int>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::Connection >, boost::arg<1> () at 0xb7a224f3
boost::asio::detail::task_io_service::run() at 0xb7a0e8b5
boost::asio::io_service::run() at io_service.ipp:57 0xb7a053ee
http::server::Server::run() at Server.C:204 0xb7a053ee
Wt::WServerImpl::runThread() at 0xb7a262eb
boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf1<void, Wt::WServerImpl, Wt::WServer*, boost::_bi::list2<boost::_bi::value<Wt::WServerImpl*>, boost::_bi::value<Wt::WServer*> > > >::run() at 0xb7a260f2
thread_proxy() at 0xb77b1dfc
start_thread() at pthread_create.c:300 0xb620c955
clone() at clone.S:130 0xb62ebe7e
Updated by Koen Deforche over 13 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
Updated by Koen Deforche over 13 years ago
- Status changed from InProgress to Resolved
- Target version set to 3.1.11
Hey,
I've solved the two cases you indicated, but you made me realize that there may be many more situations where the API is not stringent enough although it will mean certain trouble later on during a rendering phase where it is hard to relate the stack-trace to the actual cause.
But I would agree that this is more a bug than a (mis)feature.
Regards,
koen
PS Congrats !
Updated by Koen Deforche about 13 years ago
- Status changed from Resolved to Closed
Resolved in Wt 3.1.11