Valgrind errors with UIManager
- From: Alexander Shaduri <ashaduri gmail com>
- To: gtkmm-list <gtkmm-list gnome org>
- Subject: Valgrind errors with UIManager
- Date: Sat, 6 Dec 2008 21:41:48 +0400
Hello,
I have a problem with valgrind throwing errors on my program
on exit when using Gtk::UIManager. This may not seem like a big
problem, but I also get "Send report to MS" dialogs in Vista and
segfaults on exit on Solaris 10 with suncc. Both of them seem to be
caused by the same problem.
I managed to make a standalone case, which is attached.
Thanks a lot in advance!
The errors thrown with valgrind on program exit are:
-------------------------------------- snip ----------------------------------
Memcheck, a memory error detector.
Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
Using LibVEX rev 1854, a library for dynamic binary translation.
Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
Using valgrind-3.3.1, a dynamic binary instrumentation framework.
Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
For more details, rerun with: -v
Invalid read of size 4
at 0x4825319: sigc::internal::slot_rep::disconnect() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4825384: sigc::internal::slot_rep::notify(void*) (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824D79: sigc::internal::trackable_callback_list::~trackable_callback_list() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824DDA: sigc::trackable::notify_callbacks() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824E4C: sigc::trackable::~trackable() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x804DC0C: TestWindow::~TestWindow() (ui_manager.cpp:54)
by 0x804CD7B: main (ui_manager.cpp:78)
Address 0x58a42ec is 20 bytes inside a block of size 60 free'd
at 0x402233C: operator delete(void*) (vg_replace_malloc.c:342)
by 0x482558E: sigc::slot_base::~slot_base() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x48061CF: Glib::SignalProxyConnectionNode::destroy_notify_handler(void*, _GClosure*) (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x49B17A7: g_closure_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49C759F: g_signal_handlers_destroy (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3914: g_object_real_dispose (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3ACB: g_object_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x48047FF: Glib::ObjectBase::unreference() const (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x804CFC8: Glib::RefPtr<Gtk::Action>::~RefPtr() (refptr.h:185)
by 0x804CFDC: sigc::bound_argument<Glib::RefPtr<Gtk::Action> >::~bound_argument() (bound_argument.h:51)
by 0x804CFF3: sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, Glib::RefPtr<Gtk::Action>, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::~bind_functor() (bind.h:136)
by 0x804E16D: sigc::internal::typed_slot_rep<sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t>, Glib::RefPtr<Gtk::Action>, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t> >::destroy(void*) (slot.h:61)
Invalid read of size 4
at 0x4825320: sigc::internal::slot_rep::disconnect() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4825384: sigc::internal::slot_rep::notify(void*) (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824D79: sigc::internal::trackable_callback_list::~trackable_callback_list() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824DDA: sigc::trackable::notify_callbacks() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824E4C: sigc::trackable::~trackable() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x804DC0C: TestWindow::~TestWindow() (ui_manager.cpp:54)
by 0x804CD7B: main (ui_manager.cpp:78)
Address 0x58a42ec is 20 bytes inside a block of size 60 free'd
at 0x402233C: operator delete(void*) (vg_replace_malloc.c:342)
by 0x482558E: sigc::slot_base::~slot_base() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x48061CF: Glib::SignalProxyConnectionNode::destroy_notify_handler(void*, _GClosure*) (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x49B17A7: g_closure_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49C759F: g_signal_handlers_destroy (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3914: g_object_real_dispose (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3ACB: g_object_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x48047FF: Glib::ObjectBase::unreference() const (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x804CFC8: Glib::RefPtr<Gtk::Action>::~RefPtr() (refptr.h:185)
by 0x804CFDC: sigc::bound_argument<Glib::RefPtr<Gtk::Action> >::~bound_argument() (bound_argument.h:51)
by 0x804CFF3: sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, Glib::RefPtr<Gtk::Action>, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::~bind_functor() (bind.h:136)
by 0x804E16D: sigc::internal::typed_slot_rep<sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t>, Glib::RefPtr<Gtk::Action>, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t> >::destroy(void*) (slot.h:61)
Invalid write of size 4
at 0x4825323: sigc::internal::slot_rep::disconnect() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4825384: sigc::internal::slot_rep::notify(void*) (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824D79: sigc::internal::trackable_callback_list::~trackable_callback_list() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824DDA: sigc::trackable::notify_callbacks() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824E4C: sigc::trackable::~trackable() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x804DC0C: TestWindow::~TestWindow() (ui_manager.cpp:54)
by 0x804CD7B: main (ui_manager.cpp:78)
Address 0x58a42dc is 4 bytes inside a block of size 60 free'd
at 0x402233C: operator delete(void*) (vg_replace_malloc.c:342)
by 0x482558E: sigc::slot_base::~slot_base() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x48061CF: Glib::SignalProxyConnectionNode::destroy_notify_handler(void*, _GClosure*) (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x49B17A7: g_closure_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49C759F: g_signal_handlers_destroy (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3914: g_object_real_dispose (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3ACB: g_object_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x48047FF: Glib::ObjectBase::unreference() const (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x804CFC8: Glib::RefPtr<Gtk::Action>::~RefPtr() (refptr.h:185)
by 0x804CFDC: sigc::bound_argument<Glib::RefPtr<Gtk::Action> >::~bound_argument() (bound_argument.h:51)
by 0x804CFF3: sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, Glib::RefPtr<Gtk::Action>, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::~bind_functor() (bind.h:136)
by 0x804E16D: sigc::internal::typed_slot_rep<sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t>, Glib::RefPtr<Gtk::Action>, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t> >::destroy(void*) (slot.h:61)
Invalid write of size 4
at 0x482532A: sigc::internal::slot_rep::disconnect() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4825384: sigc::internal::slot_rep::notify(void*) (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824D79: sigc::internal::trackable_callback_list::~trackable_callback_list() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824DDA: sigc::trackable::notify_callbacks() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824E4C: sigc::trackable::~trackable() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x804DC0C: TestWindow::~TestWindow() (ui_manager.cpp:54)
by 0x804CD7B: main (ui_manager.cpp:78)
Address 0x58a42ec is 20 bytes inside a block of size 60 free'd
at 0x402233C: operator delete(void*) (vg_replace_malloc.c:342)
by 0x482558E: sigc::slot_base::~slot_base() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x48061CF: Glib::SignalProxyConnectionNode::destroy_notify_handler(void*, _GClosure*) (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x49B17A7: g_closure_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49C759F: g_signal_handlers_destroy (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3914: g_object_real_dispose (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3ACB: g_object_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x48047FF: Glib::ObjectBase::unreference() const (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x804CFC8: Glib::RefPtr<Gtk::Action>::~RefPtr() (refptr.h:185)
by 0x804CFDC: sigc::bound_argument<Glib::RefPtr<Gtk::Action> >::~bound_argument() (bound_argument.h:51)
by 0x804CFF3: sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, Glib::RefPtr<Gtk::Action>, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::~bind_functor() (bind.h:136)
by 0x804E16D: sigc::internal::typed_slot_rep<sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t>, Glib::RefPtr<Gtk::Action>, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t> >::destroy(void*) (slot.h:61)
Invalid read of size 4
at 0x4825334: sigc::internal::slot_rep::disconnect() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4825384: sigc::internal::slot_rep::notify(void*) (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824D79: sigc::internal::trackable_callback_list::~trackable_callback_list() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824DDA: sigc::trackable::notify_callbacks() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824E4C: sigc::trackable::~trackable() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x804DC0C: TestWindow::~TestWindow() (ui_manager.cpp:54)
by 0x804CD7B: main (ui_manager.cpp:78)
Address 0x58a42e8 is 16 bytes inside a block of size 60 free'd
at 0x402233C: operator delete(void*) (vg_replace_malloc.c:342)
by 0x482558E: sigc::slot_base::~slot_base() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x48061CF: Glib::SignalProxyConnectionNode::destroy_notify_handler(void*, _GClosure*) (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x49B17A7: g_closure_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49C759F: g_signal_handlers_destroy (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3914: g_object_real_dispose (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3ACB: g_object_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x48047FF: Glib::ObjectBase::unreference() const (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x804CFC8: Glib::RefPtr<Gtk::Action>::~RefPtr() (refptr.h:185)
by 0x804CFDC: sigc::bound_argument<Glib::RefPtr<Gtk::Action> >::~bound_argument() (bound_argument.h:51)
by 0x804CFF3: sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, Glib::RefPtr<Gtk::Action>, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::~bind_functor() (bind.h:136)
by 0x804E16D: sigc::internal::typed_slot_rep<sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t>, Glib::RefPtr<Gtk::Action>, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t> >::destroy(void*) (slot.h:61)
Invalid read of size 4
at 0x4806211: Glib::SignalProxyConnectionNode::notify(void*) (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x4825336: sigc::internal::slot_rep::disconnect() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4825384: sigc::internal::slot_rep::notify(void*) (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824D79: sigc::internal::trackable_callback_list::~trackable_callback_list() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824DDA: sigc::trackable::notify_callbacks() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x4824E4C: sigc::trackable::~trackable() (in /usr/lib/libsigc-2.0.so.0.0.0)
by 0x804DC0C: TestWindow::~TestWindow() (ui_manager.cpp:54)
by 0x804CD7B: main (ui_manager.cpp:78)
Address 0x58a42a4 is 12 bytes inside a block of size 16 free'd
at 0x402233C: operator delete(void*) (vg_replace_malloc.c:342)
by 0x48061D7: Glib::SignalProxyConnectionNode::destroy_notify_handler(void*, _GClosure*) (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x49B17A7: g_closure_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49C759F: g_signal_handlers_destroy (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3914: g_object_real_dispose (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x49B3ACB: g_object_unref (in /usr/lib/libgobject-2.0.so.0.1600.5)
by 0x48047FF: Glib::ObjectBase::unreference() const (in /usr/lib/libglibmm-2.4.so.1.0.24)
by 0x804CFC8: Glib::RefPtr<Gtk::Action>::~RefPtr() (refptr.h:185)
by 0x804CFDC: sigc::bound_argument<Glib::RefPtr<Gtk::Action> >::~bound_argument() (bound_argument.h:51)
by 0x804CFF3: sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, Glib::RefPtr<Gtk::Action>, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::~bind_functor() (bind.h:136)
by 0x804E16D: sigc::internal::typed_slot_rep<sigc::bind_functor<-1, sigc::bind_functor<-1, sigc::bound_mem_functor2<void, TestWindow, Glib::RefPtr<Gtk::Action>, TestWindow::action_t>, TestWindow::action_t, sigc::nil, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t>, Glib::RefPtr<Gtk::Action>, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t, TestWindow::action_t> >::destroy(void*) (slot.h:61)
by 0x482537C: sigc::internal::slot_rep::notify(void*) (in /usr/lib/libsigc-2.0.so.0.0.0)
ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 17 from 2)
malloc/free: in use at exit: 639,121 bytes in 11,728 blocks.
malloc/free: 41,392 allocs, 29,664 frees, 4,820,727 bytes allocated.
For counts of detected errors, rerun with: -v
searching for pointers to 11,728 not-freed blocks.
checked 956,340 bytes.
LEAK SUMMARY:
definitely lost: 53,861 bytes in 1,894 blocks.
possibly lost: 85,240 bytes in 89 blocks.
still reachable: 500,020 bytes in 9,745 blocks.
suppressed: 0 bytes in 0 blocks.
Rerun with --leak-check=full to see details of leaked memory.
#include <iostream>
#include <gtkmm.h>
// compile with:
// g++ -g2 -O0 `pkg-config --cflags --libs gtkmm-2.4` test_ui_manager.cpp -o test_ui_manager
class TestWindow : public Gtk::Window
{
public:
enum action_t {
action_quit
};
TestWindow()
{
Gtk::Box* vbox = Gtk::manage(new Gtk::VBox(false, 5));
add(*vbox);
Gtk::Label* label = Gtk::manage(new Gtk::Label("AAAAAAAAAAAAAAAA"));
vbox->pack_start(*label, Gtk::PACK_SHRINK);
show_all();
Glib::ustring ui_info =
"<menubar name='main_menubar'>"
" <menu action='file_menu'>"
" <menuitem action='action_quit' />"
" </menu>"
"</menubar>";
actiongroup_main = Gtk::ActionGroup::create("main_actions");
actiongroup_main->add(Gtk::Action::create("file_menu", "_File"));
Glib::RefPtr<Gtk::Action> action = Gtk::Action::create("action_quit", Gtk::Stock::QUIT);
actiongroup_main->add(action, Gtk::AccelKey("<control>Q"),
sigc::bind(sigc::bind(sigc::mem_fun(*this, &TestWindow::on_action_activated), action_quit), action));
// create uimanager
ui_manager = Gtk::UIManager::create();
ui_manager->insert_action_group(actiongroup_main);
try {
ui_manager->add_ui_from_string(ui_info);
}
catch(Glib::Error& ex) {
std::cerr << "UI Create failed: " << ex.what() << "\n";
}
}
virtual ~TestWindow()
{ }
private:
void on_action_activated(Glib::RefPtr<Gtk::Action> action, action_t action_type)
{
std::cerr << "TestWindow::on_action_activated()\n";
}
Glib::RefPtr<Gtk::UIManager> ui_manager;
Glib::RefPtr<Gtk::ActionGroup> actiongroup_main;
};
int main(int argc, char *argv[])
{
Gtk::Main m(&argc, &argv);
TestWindow app;
m.run(app);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]