Project

General

Profile

Actions

Support #1649

open

WStandardItemModel & WSortFilterProxyModel for n clients

Added by navnidhi sharma about 11 years ago. Updated about 11 years ago.

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

0%

Estimated time:

Description

Is it possible to use the same model across the clients, but using their own filter? So, if the application has n clients, there would be single model with n filters. In my case the clients cannot change the contents of the model; however, they can have different filter, e.g. sort, column selection, and so on.

model = new WStandardItemModel(this);

filter = new Wt::WSortFilterProxyModel(this);

filter->setSourceModel(model);

Thanks!


Files

file.log (29.7 KB) file.log navnidhi sharma, 02/01/2013 03:39 PM
Actions #1

Updated by Wim Dumon about 11 years ago

Yes. For each client, you make a WReadOnlyProxyModel that shares the shared model. On that readonly model, you can set a sorting proxymodel.

BR,

Wim.

Actions #2

Updated by navnidhi sharma about 11 years ago

It worked. Thank you.

However, I want to ask a question unless you want me to create a new ticket. FYI- it was happening before the proxy change that I just made after your answer also.

I am using Auth and ServerPush examples together. I see the screen, but logout is messed up. For a reason my Application derived class dtor is being called twice. Since the class has shared pointer, in the second call it generates the crash. The following is the code and back-trace.

//it crashed in dtor of imrSTP::ref(new imrSTP())

~ManageRisk::iManageRisk() {

authModel_ = new Wt::Auth::AuthModel(imrSession::auth(), wtsession_.users(), this);

authModel_->addPasswordAuth(&imrSession::passwordAuth());

authModel_->addOAuth(imrSession::oAuth());

authWidget_ = new Wt::Auth::AuthWidget(wtsession_.login());

authWidget*->setModel(authModel*);

authWidget_->setRegistrationEnabled(true);

menuStack_.setStyleClass("menu");

menu_.setRenderAsList(false);

screens_[eSTP] = std::make_pair(Wt::WString("STP"), imrSTP::ref(new imrSTP()));

for (auto x: screens_) setMenu(x.second.first, x.second.second);

addWidget(&menu_);

addWidget(new Wt::WText(\"

\"));

addWidget(authWidget_);

addWidget(&menuStack_);

...

}

iManageRisk::~iManageRisk() {

}

BackTrace-

First Call- (No crash and it deletes the shared pointer- )

Breakpoint 1, iManageRisk::~iManageRisk (this=0x7fffcc0096a0, __in_chrg=) at ui/iManageRisk.cpp:110

110 iManageRisk::~iManageRisk() {

Missing separate debuginfos, use: debuginfo-install audit-libs-2.2-2.el6.x86_64 db4-4.7.25-17.el6.x86_64 glibc-2.12-1.80.el6_3.6.x86_64 keyutils-libs-1.4-4.el6.x86_64 krb5-libs-1.9-33.el6_3.3.x86_64 libcom_err-1.41.12-12.el6.x86_64 libselinux-2.0.94-5.3.el6.x86_64 libxml2-2.7.6-8.el6_3.4.x86_64 nss-softokn-freebl-3.12.9-11.el6.x86_64 openssl-1.0.0-25.el6_3.1.x86_64 pam-1.1.1-10.el6_2.1.x86_64 zlib-1.2.3-27.el6.x86_64

(gdb) print this->screens_

$1 = std::map with 1 elements = {

[0] = {first = {static Empty = {static Empty = , utf8_ = Traceback (most recent call last):

File "/usr/local/lib64/../share/gcc-4.7.2/python/libstdcxx/v6/printers.py", line 605, in to_string

return ptr.lazy_string (length = len)

RuntimeError: Cannot access memory at address 0xffffffffffffffe8

, static stArguments_ = {<std::_Vector_base<Wt::WString, std::allocatorWt::WString >> = {

M_impl = {<std::allocatorWt::WString> = {<_gnu_cxx::new_allocatorWt::WString> = {}, }, _M_start = 0x0, _M_finish = 0x0,

M_end_of_storage = 0x0}}, }, impl = 0x0}, utf8_ = "STP", static stArguments_ = , impl_ = 0x0}, second =

std::shared_ptr (count 1, weak 0) 0x7fffcc033b30}

}

(gdb) bt

#0 iManageRisk::~iManageRisk (this=0x7fffcc0096a0, __in_chrg=) at ui/iManageRisk.cpp:110

#1 0x00007ffff7b61466 in Wt::WWebWidget::~WWebWidget (this=0x7fffcc002520, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WWebWidget.C:251

#2 0x00007ffff7a12529 in Wt::WContainerWidget::~WContainerWidget (this=0x7fffcc002520, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WContainerWidget.C:72

#3 0x00007ffff7b61466 in Wt::WWebWidget::~WWebWidget (this=0x7fffcc001fb0, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WWebWidget.C:251

#4 0x00007ffff7a12529 in Wt::WContainerWidget::~WContainerWidget (this=0x7fffcc001fb0, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WContainerWidget.C:72

#5 0x00007ffff79d0a8e in Wt::WApplication::~WApplication (this=0x7fffcc004730, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WApplication.C:373

#6 0x00007ffff79d1239 in Wt::WApplication::~WApplication (this=0x7fffcc004730, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WApplication.C:388

#7 0x00007ffff7c4994a in Wt::WebSession::~WebSession (this=0x7fffb8014e50, __in_chrg=) at /usr/local/wt-3.2.3/src/web/WebSession.C:219

#8 0x00007ffff7c36202 in checked_deleteWt::WebSession (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/checked_delete.hpp:34

#9 boost::detail::sp_counted_impl_pWt::WebSession::dispose (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/detail/sp_counted_impl.hpp:78

#10 0x00007ffff7c365c9 in release (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:145

#11 ~shared_count (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/detail/shared_count.hpp:371

#12 ~shared_ptr (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/shared_ptr.hpp:327

#13 boost::shared_ptrWt::WebSession::reset (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/shared_ptr.hpp:551

#14 0x00007ffff7c351ff in Wt::WebController::handleRequest (this=0x7c9470, request=0x7fffcc001940) at /usr/local/wt-3.2.3/src/web/WebController.C:641

#15 0x00007ffff6d2e75f in http::server::WtReply::consumeRequestBody (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/wt-3.2.3/src/http/WtReply.C:140

#16 0x00007ffff6d0f1e4 in http::server::RequestParser::parseBody (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/wt-3.2.3/src/http/RequestParser.C:141

#17 0x00007ffff6cf936c in http::server::Connection::handleReadBody (this=0x7fffb8000a90) at /usr/local/wt-3.2.3/src/http/Connection.C:226

#18 0x00007ffff6cfa7ef in http::server::Connection::handleReadRequest0 (this=0x7fffb8000a90) at /usr/local/wt-3.2.3/src/http/Connection.C:165

#19 0x00007ffff6d29e16 in call<boost::shared_ptrhttp::server::TcpConnection, boost::system::error_code const, unsigned long> (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/bind/mem_fn_template.hpp:271

#20 operator()<boost::shared_ptrhttp::server::TcpConnection > (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/bind/mem_fn_template.hpp:286

#21 operator()<boost::_mfi::mf2<void, http::server::Connection, const boost::system::error_code&, long unsigned int>, boost::_bi::list2<const boost::system::error_code&, const long unsigned int&> > (

owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/bind/bind.hpp:392

#22 operator()<boost::system::error_code, long unsigned int> (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/bind/bind_template.hpp:102

#23 operator() (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/asio/detail/bind_handler.hpp:118

#24 asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, http::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> >, boost::system::error_code, unsigned long> > (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/asio/handler_invoke_hook.hpp:64

#25 invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, http::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> >, boost::system::error_code, unsigned long>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, http::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> > > (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/asio/detail/handler_invoke_helpers.hpp:39

#26 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 long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> > >::do_complete (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/asio/detail/reactive_socket_recv_op.hpp:110

#27 0x00007ffff7a73cd3 in complete (this=0x7c9a50, ec=...) at /usr/local/include/boost/asio/detail/task_io_service_operation.hpp:37

#28 do_run_one (this=0x7c9a50, ec=...) at /usr/local/include/boost/asio/detail/impl/task_io_service.ipp:419

#29 boost::asio::detail::task_io_service::run (this=0x7c9a50, ec=...) at /usr/local/include/boost/asio/detail/impl/task_io_service.ipp:160

#30 0x00007ffff7a70d0b in run (this=0x7c9f50) at /usr/local/include/boost/asio/impl/io_service.ipp:59

#31 Wt::WIOService::run (this=0x7c9f50) at /usr/local/wt-3.2.3/src/Wt/WIOService.C:133

#32 0x00007ffff67b2819 in thread_proxy () from /usr/local/lib/libboost_thread.so.1.53.0

#33 0x00000033ecc07851 in start_thread () from /lib64/libpthread.so.0

#34 0x00000033ec0e811d in clone () from /lib64/libc.so.6

Second Call- (crashed and it tries to delete the share pointer that has been already deleted-)

Breakpoint 1, iManageRisk::~iManageRisk (this=0x7fffcc0096a0, __in_chrg=) at ui/iManageRisk.cpp:110

110 iManageRisk::~iManageRisk() {

(gdb) print this->screens_

$2 = std::map with 1 elements = {

[0] = {first = {static Empty = {static Empty = , utf8_ = Traceback (most recent call last):

File "/usr/local/lib64/../share/gcc-4.7.2/python/libstdcxx/v6/printers.py", line 605, in to_string

return ptr.lazy_string (length = len)

RuntimeError: Cannot access memory at address 0xffffffffffffffe8

, static stArguments_ = {<std::_Vector_base<Wt::WString, std::allocatorWt::WString >> = {

M_impl = {<std::allocatorWt::WString> = {<_gnu_cxx::new_allocatorWt::WString> = {}, }, _M_start = 0x0, _M_finish = 0x0,

M_end_of_storage = 0x0}}, }, impl = 0x0}, utf8_ = "STP", static stArguments_ = , impl_ = 0x0},

second = std::shared_ptr (count 1, weak 0) 0x7fffcc033b30}

}

(gdb) bt

#0 iManageRisk::~iManageRisk (this=0x7fffcc0096a0, __in_chrg=) at ui/iManageRisk.cpp:110

#1 0x00000000004b7679 in iManageRisk::~iManageRisk (this=0x7fffcc0096a0, __in_chrg=) at ui/iManageRisk.cpp:111

#2 0x00007ffff7b61466 in Wt::WWebWidget::~WWebWidget (this=0x7fffcc002520, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WWebWidget.C:251

#3 0x00007ffff7a12529 in Wt::WContainerWidget::~WContainerWidget (this=0x7fffcc002520, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WContainerWidget.C:72

#4 0x00007ffff7b61466 in Wt::WWebWidget::~WWebWidget (this=0x7fffcc001fb0, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WWebWidget.C:251

#5 0x00007ffff7a12529 in Wt::WContainerWidget::~WContainerWidget (this=0x7fffcc001fb0, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WContainerWidget.C:72

#6 0x00007ffff79d0a8e in Wt::WApplication::~WApplication (this=0x7fffcc004730, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WApplication.C:373

#7 0x00007ffff79d1239 in Wt::WApplication::~WApplication (this=0x7fffcc004730, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WApplication.C:388

#8 0x00007ffff7c4994a in Wt::WebSession::~WebSession (this=0x7fffb8014e50, __in_chrg=) at /usr/local/wt-3.2.3/src/web/WebSession.C:219

#9 0x00007ffff7c36202 in checked_deleteWt::WebSession (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/checked_delete.hpp:34

#10 boost::detail::sp_counted_impl_pWt::WebSession::dispose (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/detail/sp_counted_impl.hpp:78

#11 0x00007ffff7c365c9 in release (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:145

#12 ~shared_count (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/detail/shared_count.hpp:371

#13 ~shared_ptr (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/shared_ptr.hpp:327

#14 boost::shared_ptrWt::WebSession::reset (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/shared_ptr.hpp:551

#15 0x00007ffff7c351ff in Wt::WebController::handleRequest (this=0x7c9470, request=0x7fffcc001940) at /usr/local/wt-3.2.3/src/web/WebController.C:641

#16 0x00007ffff6d2e75f in http::server::WtReply::consumeRequestBody (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/wt-3.2.3/src/http/WtReply.C:140

#17 0x00007ffff6d0f1e4 in http::server::RequestParser::parseBody (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/wt-3.2.3/src/http/RequestParser.C:141

#18 0x00007ffff6cf936c in http::server::Connection::handleReadBody (this=0x7fffb8000a90) at /usr/local/wt-3.2.3/src/http/Connection.C:226

#19 0x00007ffff6cfa7ef in http::server::Connection::handleReadRequest0 (this=0x7fffb8000a90) at /usr/local/wt-3.2.3/src/http/Connection.C:165

#20 0x00007ffff6d29e16 in call<boost::shared_ptrhttp::server::TcpConnection, boost::system::error_code const, unsigned long> (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/bind/mem_fn_template.hpp:271

#21 operator()<boost::shared_ptrhttp::server::TcpConnection > (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/bind/mem_fn_template.hpp:286

#22 operator()<boost::_mfi::mf2<void, http::server::Connection, const boost::system::error_code&, long unsigned int>, boost::_bi::list2<const boost::system::error_code&, const long unsigned int&> > (

owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/bind/bind.hpp:392

#23 operator()<boost::system::error_code, long unsigned int> (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/bind/bind_template.hpp:102

#24 operator() (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/asio/detail/bind_handler.hpp:118

#25 asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, http::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> >, boost::system::error_code, unsigned long> > (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/asio/handler_invoke_hook.hpp:64

#26 invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, http::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> >, boost::system::error_code, unsigned long>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, http::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> > > (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/asio/detail/handler_invoke_helpers.hpp:39

#27 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 long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> > >::do_complete (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/asio/detail/reactive_socket_recv_op.hpp:110

#28 0x00007ffff7a73cd3 in complete (this=0x7c9a50, ec=...) at /usr/local/include/boost/asio/detail/task_io_service_operation.hpp:37

#29 do_run_one (this=0x7c9a50, ec=...) at /usr/local/include/boost/asio/detail/impl/task_io_service.ipp:419

#30 boost::asio::detail::task_io_service::run (this=0x7c9a50, ec=...) at /usr/local/include/boost/asio/detail/impl/task_io_service.ipp:160

#31 0x00007ffff7a70d0b in run (this=0x7c9f50) at /usr/local/include/boost/asio/impl/io_service.ipp:59

#32 Wt::WIOService::run (this=0x7c9f50) at /usr/local/wt-3.2.3/src/Wt/WIOService.C:133

#33 0x00007ffff67b2819 in thread_proxy () from /usr/local/lib/libboost_thread.so.1.53.0

#34 0x00000033ecc07851 in start_thread () from /lib64/libpthread.so.0

#35 0x00000033ec0e811d in clone () from /lib64/libc.so.6

Now Crash report-

Program received signal SIGSEGV, Segmentation fault.

0x00000000000000a1 in ?? () at /usr/local/include/boost/smart_ptr/shared_ptr.hpp:343

343 explicit shared_ptr( Y * p ): px( p ), pn() // Y must be complete

(gdb) bt

#0 0x00000000000000a1 in ?? () at /usr/local/include/boost/smart_ptr/shared_ptr.hpp:343

#1 0x00000000004ba465 in M_release (this=0x7fffcc0099a0,_x=0x7fffcc03b1b0) at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/bits/shared_ptr_base.h:147

#2 ~_shared_count (this=0x7fffcc0099a0,_x=0x7fffcc03b1b0) at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/bits/shared_ptr_base.h:558

#3 ~_shared_ptr (this=0x7fffcc0099a0,_x=0x7fffcc03b1b0) at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/bits/shared_ptr_base.h:813

#4 ~shared_ptr (this=0x7fffcc0099a0, __x=0x7fffcc03b1b0) at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/bits/shared_ptr.h:93

#5 ~pair (this=0x7fffcc0099a0, __x=0x7fffcc03b1b0) at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/bits/stl_pair.h:88

#6 ~pair (this=0x7fffcc0099a0, __x=0x7fffcc03b1b0) at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/bits/stl_pair.h:88

#7 ~Rb_tree_node (this=0x7fffcc0099a0,_x=0x7fffcc03b1b0) at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/bits/stl_tree.h:130

#8 destroy<std::Rb_tree_node<std::pair<int const, std::pair<Wt::WString, std::shared_ptr > > > > (this=0x7fffcc0099a0,_x=0x7fffcc03b1b0)

at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/ext/new_allocator.h:114

#9 M_destroy_node (this=0x7fffcc0099a0,_x=0x7fffcc03b1b0) at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/bits/stl_tree.h:419

#10 std::_Rb_tree<int, std::pair<int const, std::pair<Wt::WString, std::shared_ptr > >, std::_Select1st<std::pair<int const, std::pair<Wt::WString, std::shared_ptr > > >, std::less, std::allocator<std::pair<int const, std::pair<Wt::WString, std::shared_ptr > > > >::M_erase (this=0x7fffcc0099a0,_x=0x7fffcc03b1b0)

at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/bits/stl_tree.h:1084

#11 0x00000000004b755e in ~Rb_tree (this=0x7fffcc0096a0,_in_chrg=) at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/bits/stl_tree.h:646

#12 ~map (this=0x7fffcc0096a0, __in_chrg=) at /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.7.2/../../../../include/c/4.7.2/bits/stl_map.h:90

#13 iManageRisk::~iManageRisk (this=0x7fffcc0096a0, __in_chrg=) at ui/iManageRisk.cpp:110

#14 0x00000000004b7679 in iManageRisk::~iManageRisk (this=0x7fffcc0096a0, __in_chrg=) at ui/iManageRisk.cpp:111

#15 0x00007ffff7b61466 in Wt::WWebWidget::~WWebWidget (this=0x7fffcc002520, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WWebWidget.C:251

#16 0x00007ffff7a12529 in Wt::WContainerWidget::~WContainerWidget (this=0x7fffcc002520, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WContainerWidget.C:72

#17 0x00007ffff7b61466 in Wt::WWebWidget::~WWebWidget (this=0x7fffcc001fb0, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WWebWidget.C:251

#18 0x00007ffff7a12529 in Wt::WContainerWidget::~WContainerWidget (this=0x7fffcc001fb0, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WContainerWidget.C:72

#19 0x00007ffff79d0a8e in Wt::WApplication::~WApplication (this=0x7fffcc004730, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WApplication.C:373

#20 0x00007ffff79d1239 in Wt::WApplication::~WApplication (this=0x7fffcc004730, __in_chrg=) at /usr/local/wt-3.2.3/src/Wt/WApplication.C:388

#21 0x00007ffff7c4994a in Wt::WebSession::~WebSession (this=0x7fffb8014e50, __in_chrg=) at /usr/local/wt-3.2.3/src/web/WebSession.C:219

#22 0x00007ffff7c36202 in checked_deleteWt::WebSession (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/checked_delete.hpp:34

#23 boost::detail::sp_counted_impl_pWt::WebSession::dispose (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/detail/sp_counted_impl.hpp:78

#24 0x00007ffff7c365c9 in release (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:145

#25 ~shared_count (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/detail/shared_count.hpp:371

#26 ~shared_ptr (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/shared_ptr.hpp:327

#27 boost::shared_ptrWt::WebSession::reset (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/smart_ptr/shared_ptr.hpp:551

#28 0x00007ffff7c351ff in Wt::WebController::handleRequest (this=0x7c9470, request=0x7fffcc001940) at /usr/local/wt-3.2.3/src/web/WebController.C:641

#29 0x00007ffff6d2e75f in http::server::WtReply::consumeRequestBody (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/wt-3.2.3/src/http/WtReply.C:140

#30 0x00007ffff6d0f1e4 in http::server::RequestParser::parseBody (this=Unhandled dwarf expression opcode 0xf3

) at /usr/local/wt-3.2.3/src/http/RequestParser.C:141

#31 0x00007ffff6cf936c in http::server::Connection::handleReadBody (this=0x7fffb8000a90) at /usr/local/wt-3.2.3/src/http/Connection.C:226

#32 0x00007ffff6cfa7ef in http::server::Connection::handleReadRequest0 (this=0x7fffb8000a90) at /usr/local/wt-3.2.3/src/http/Connection.C:165

#33 0x00007ffff6d29e16 in call<boost::shared_ptrhttp::server::TcpConnection, boost::system::error_code const, unsigned long> (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/bind/mem_fn_template.hpp:271

#34 operator()<boost::shared_ptrhttp::server::TcpConnection > (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/bind/mem_fn_template.hpp:286

#35 operator()<boost::_mfi::mf2<void, http::server::Connection, const boost::system::error_code&, long unsigned int>, boost::_bi::list2<const boost::system::error_code&, const long unsigned int&> > (

owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/bind/bind.hpp:392

#36 operator()<boost::system::error_code, long unsigned int> (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/bind/bind_template.hpp:102

#37 operator() (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

) at /usr/local/include/boost/asio/detail/bind_handler.hpp:118

#38 asio_handler_invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, http::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> >, boost::system::error_code, unsigned long> > (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/asio/handler_invoke_hook.hpp:64

#39 invoke<boost::asio::detail::binder2<boost::_bi::bind_t<void, boost::_mfi::mf2<void, http::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> >, boost::system::error_code, unsigned long>, boost::_bi::bind_t<void, boost::_mfi::mf2<void, http::server::Connection, boost::system::error_code const&, unsigned long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> > > (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/asio/detail/handler_invoke_helpers.hpp:39

#40 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 long>, boost::_bi::list3<boost::_bi::value<boost::shared_ptrhttp::server::TcpConnection >, boost::arg<1> ()(), boost::arg<2> ()()> > >::do_complete (owner=0x7c9a50, base=Unhandled dwarf expression opcode 0xf3

)

at /usr/local/include/boost/asio/detail/reactive_socket_recv_op.hpp:110

#41 0x00007ffff7a73cd3 in complete (this=0x7c9a50, ec=...) at /usr/local/include/boost/asio/detail/task_io_service_operation.hpp:37

#42 do_run_one (this=0x7c9a50, ec=...) at /usr/local/include/boost/asio/detail/impl/task_io_service.ipp:419

#43 boost::asio::detail::task_io_service::run (this=0x7c9a50, ec=...) at /usr/local/include/boost/asio/detail/impl/task_io_service.ipp:160

#44 0x00007ffff7a70d0b in run (this=0x7c9f50) at /usr/local/include/boost/asio/impl/io_service.ipp:59

#45 Wt::WIOService::run (this=0x7c9f50) at /usr/local/wt-3.2.3/src/Wt/WIOService.C:133

#46 0x00007ffff67b2819 in thread_proxy () from /usr/local/lib/libboost_thread.so.1.53.0

#47 0x00000033ecc07851 in start_thread () from /lib64/libpthread.so.0

#48 0x00000033ec0e811d in clone () from /lib64/libc.so.6

Actions #3

Updated by navnidhi sharma about 11 years ago

FYI - the following code (Wt::WApplication::instance()->quit();) triggers the dtor twice. My question is how to clean the session using logout.

void TheClass::onAuthEvent() {

if (wtsession_.login().loggedIn()) {

showMainScreen();

}

if (!wtsession_.login().loggedIn()) {

//menuStack_.clear();

Wt::WApplication::instance()->quit();

}

}

Actions #4

Updated by Wim Dumon about 11 years ago

Can you run this in valgrind and check if you see any other memory releated issues?

BR,

Wim.

Actions #5

Updated by navnidhi sharma about 11 years ago

You may close the issue. Thanks.

It worked once i moved down the shared ptr screen menu array to the last, in fact after the menu and using the following dtor-

if (!wtsession_.login().loggedIn()) {

removeWidget(&menu_);

removeWidget(&lineBreak);

removeWidget(&menuStack_);

removeWidget(&authWidget_);

Wt::WApplication::instance()->quit();

Wt::WApplication::instance()redirect(Wt::WApplication::instance()>bookmarkUrl());

}

note screens_ below

Correct dtor sequence

@ Wt::Dbo::backend::Sqlite3 appldb_{"imr.db"};

Wt::Dbo::Session applSession_;

imrSession wtsession_;

ScreenCaptions screenCaptions_;

Wt::WStackedWidget menuStack_{this};

Wt::WMenu menu_{&menuStack_, Wt::Horizontal, this};

Wt::WText lineBreak{\"

\"};

Wt::Auth::AuthModel authModel_{imrSession::auth(), wtsession_.users(), this};

Wt::Auth::AuthWidget authWidget_{wtsession_.login()};

Screens screens_;@

Wrong dtor sequence

@ Wt::Dbo::backend::Sqlite3 appldb_{"imr.db"};

Wt::Dbo::Session applSession_;

imrSession wtsession_;

ScreenCaptions screenCaptions_;

  • Screens screens_;*

Wt::WStackedWidget menuStack_{this};

Wt::WMenu menu_{&menuStack_, Wt::Horizontal, this};

Wt::WText lineBreak{\"

\"};

Wt::Auth::AuthModel authModel_{imrSession::auth(), wtsession_.users(), this};

Wt::Auth::AuthWidget authWidget_{wtsession_.login()};

@

Actions #6

Updated by Koen Deforche about 11 years ago

  • Status changed from New to Feedback

Hey,

I notice that you are embedding child widgets inside another widget... this is not something I would recommend (it'll only increase compile times ?), but I suspect that is the reason why it fails (Wt implicit passes ownership with addWidget() to the parent, so in your case, the parent will own the child widget twice).

I'm actually curious if you can do something like that in Qt which has the same parent-child memory management relationships.

Regards,

koen

Actions #7

Updated by navnidhi sharma about 11 years ago

It seems something is not right, so just to confirm-

Current Code- This is working- sorts, displays column and data, dynamically reflects the model changes

@

std::unique_ptrWt::WSortFilterProxyModel filter{new Wt::WSortFilterProxyModel()};

Wt::WStandardItemModel model;

model.invisibleRootItem()->setRowCount(0);

filter->setSourceModel(&model);

filter->setDynamicSortFilter(true);

filter->setFilterKeyColumn(16);

filter->setFilterRole(Wt::UserRole);

pieChart_->setModel(filter.get());

filter->setFilterRegExp("test");

view_->setModel(filter.get());

@

New code-

@

std::unique_ptrWt::WSortFilterProxyModel filter{new Wt::WSortFilterProxyModel()};

std::unique_ptrWt::WReadOnlyProxyModel roModel{new Wt::WReadOnlyProxyModel()};

Wt::WStandardItemModel model;

model.invisibleRootItem()->setRowCount(0);

roModel_->setSourceModel(&model);

filter->setSourceModel(roModel.get());

filter->setDynamicSortFilter(true);

filter->setFilterKeyColumn(16);

filter->setFilterRole(Wt::UserRole);

pieChart_->setModel(filter.get());

filter->setFilterRegExp("test");

view_->setModel(filter.get());

@

I do not see column header in the new code and the dynamic update . All the data is being added/removed in the model that is supposed to be unique.

Thanks

Wim Dumon wrote:

Yes. For each client, you make a WReadOnlyProxyModel that shares the shared model. On that readonly model, you can set a sorting proxymodel.

BR,

Wim.

Actions

Also available in: Atom PDF