Actions
Bug #4509
closedDeleting empty layout segfault
Start date:
10/13/2015
Due date:
% Done:
0%
Estimated time:
Description
Calling clear on an empty WContainer with a layout set causes segfault.
Calling 'delete' on a layout causes a chain of events which eventually
references the layout_ variable before it is set to zero.
There is a workaround for this in the WContainer destructor but not in
the clear() or setLayout() functions.
I have attached a test case and a patch which resolves the issue for me.
Stacktrace:
Thread 1 (LWP 449):
#0 0xb660c894 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1 0xb6610394 in __GI_abort () at abort.c:89
#2 0xb67f9d64 in __gnu_cxx::__verbose_terminate_handler ()
at /home/modonovan/poky-fido/build/tmp/work-shared/gcc-4.9.2-r0/gcc-4.9.2/libstdc++-v3/libsupc++/vterminate.cc:95
#3 0xb67f7b9c in __cxxabiv1::__terminate (handler=<optimized out>)
at /home/modonovan/poky-fido/build/tmp/work-shared/gcc-4.9.2-r0/gcc-4.9.2/libstdc++-v3/libsupc++/eh_terminate.cc:47
#4 0xb67f7c10 in std::terminate ()
at /home/modonovan/poky-fido/build/tmp/work-shared/gcc-4.9.2-r0/gcc-4.9.2/libstdc++-v3/libsupc++/eh_terminate.cc:57
#5 0xb67f88c0 in __cxxabiv1::__cxa_pure_virtual ()
at /home/modonovan/poky-fido/build/tmp/work-shared/gcc-4.9.2-r0/gcc-4.9.2/libstdc++-v3/libsupc++/pure.cc:50
#6 0xb6adffa0 in Wt::WContainerWidget::parentResized (this=0x4d9f0, parent=<optimized out>, directions=...)
at /usr/src/debug/wt/3.3.4-3/git/src/Wt/WContainerWidget.C:135
#7 0xb6ca1f08 in Wt::WWidget::scheduleRerender (this=0x4d9f0, laterOnly=<optimized out>, flags=...)
at /usr/src/debug/wt/3.3.4-3/git/src/Wt/WWidget.C:136
#8 0xb6c89b34 in Wt::WWebWidget::repaint (this=this@entry=0x4d9f0, flags=...) at /usr/src/debug/wt/3.3.4-3/git/src/Wt/WWebWidget.C:225
#9 0xb6ade500 in Wt::WContainerWidget::layoutChanged (this=0x4d9f0, rerender=rerender@entry=true, deleted=deleted@entry=true)
at /usr/src/debug/wt/3.3.4-3/git/src/Wt/WContainerWidget.C:826
#10 0xb6a39490 in Wt::StdLayoutImpl::~StdLayoutImpl (this=0x5a710, __in_chrg=<optimized out>)
at /usr/src/debug/wt/3.3.4-3/git/src/Wt/StdLayoutImpl.C:23
#11 0xb6a339b4 in Wt::StdGridLayoutImpl2::~StdGridLayoutImpl2 (this=0x5a710, __in_chrg=<optimized out>)
at /usr/src/debug/wt/3.3.4-3/git/src/Wt/StdGridLayoutImpl2.C:223
#12 0xb6a33be8 in Wt::StdGridLayoutImpl2::~StdGridLayoutImpl2 (this=0x5a710, __in_chrg=<optimized out>)
at /usr/src/debug/wt/3.3.4-3/git/src/Wt/StdGridLayoutImpl2.C:240
#13 0xb6b7a448 in Wt::WLayout::~WLayout (this=0x49b30, __in_chrg=<optimized out>) at /usr/src/debug/wt/3.3.4-3/git/src/Wt/WLayout.C:26
#14 0xb6b4c118 in ~WBoxLayout (this=0x49b30, __in_chrg=<optimized out>) at /usr/src/debug/wt/3.3.4-3/git/src/Wt/WBoxLayout:104
#15 ~WHBoxLayout (this=0x49b30, __in_chrg=<optimized out>) at /usr/src/debug/wt/3.3.4-3/git/src/Wt/WHBoxLayout:54
#16 Wt::WHBoxLayout::~WHBoxLayout (this=0x49b30, __in_chrg=<optimized out>) at /usr/src/debug/wt/3.3.4-3/git/src/Wt/WHBoxLayout:54
#17 0xb6addcf0 in Wt::WContainerWidget::clear (this=0x4d9f0) at /usr/src/debug/wt/3.3.4-3/git/src/Wt/WContainerWidget.C:272
#18 0x0000dbf8 in MultiButtonWidget::refresh (this=0x4d9f0) at main.cpp:21
#19 0x0000ddb4 in ExampleProgram::ExampleProgram(Wt::WEnvironment const&)::{lambda()#1}::operator()() const () at main.cpp:58
#20 0x00016670 in std::_Bind<ExampleProgram::ExampleProgram(Wt::WEnvironment const&)::{lambda()#1} ()>::__call<void, Wt::WMouseEvent&>(std::tuple<Wt::WMouseEvent&>&&, std::_Index_tuple<>) (this=0x4ff40,
__args=<unknown type in /home/modonovan/Dropbox/projects/wt/container_bug/main, CU 0x1c9, DIE 0x2b2f1>)
at /opt/poky/1.8/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi/usr/include/c++/4.9.2/functional:1264
#21 0x00015118 in std::_Bind<ExampleProgram::ExampleProgram(Wt::WEnvironment const&)::{lambda()#1} ()>::operator()<Wt::WMouseEvent&, void>(Wt::WMouseEvent&) (this=0x4ff40) at /opt/poky/1.8/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi/usr/include/c++/4.9.2/functional:1323
---Type <return> to continue, or q <return> to quit---
#22 0x00013d44 in boost::detail::function::void_function_obj_invoker1<std::_Bind<ExampleProgram::ExampleProgram(Wt::WEnvironment const&)::{lambda()#1} ()>, void, Wt::WMouseEvent>::invoke(boost::detail::function::function_buffer&, std::_Bind<ExampleProgram::ExampleProgram(Wt::WEnvironment const&)::{lambda()#1} ()>) (function_obj_ptr=..., a0=...)
at /opt/poky/1.8/sysroots/cortexa8hf-vfp-neon-poky-linux-gnueabi/usr/include/boost/function/function_template.hpp:153
#23 0xb6b05d64 in operator() (a0=..., this=0x4ff3c)
at /home/modonovan/poky-fido/build/tmp/sysroots/biotector/usr/include/boost/function/function_template.hpp:767
#24 m_invoke (connectionBody=..., this=0xb2a32464)
at /home/modonovan/poky-fido/build/tmp/sysroots/biotector/usr/include/boost/signals2/detail/signal_template.hpp:363
#25 operator() (connectionBody=..., this=0xb2a32464)
at /home/modonovan/poky-fido/build/tmp/sysroots/biotector/usr/include/boost/signals2/detail/signal_template.hpp:345
#26 dereference (this=0xb2a323cc)
Regards,
Mark
Files
Updated by Koen Deforche about 9 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
- Target version set to 3.3.5
Updated by Koen Deforche about 9 years ago
- Assignee changed from Koen Deforche to Michael Vilsker
Updated by Michael Vilsker about 9 years ago
- Status changed from InProgress to Implemented @Emweb
Thanks for the patch
Updated by Koen Deforche about 9 years ago
- Status changed from Implemented @Emweb to Closed
Actions