After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 93577 - valgrind detects illegal read access during Gtk::Main destruction
valgrind detects illegal read access during Gtk::Main destruction
Status: RESOLVED NOTABUG
Product: gtkmm
Classification: Bindings
Component: general
2.0
Other other
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2002-09-18 15:33 UTC by Tassos Bassoukos
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Tassos Bassoukos 2002-09-18 15:33:28 UTC
program:

#include <gtkmm.h>

int main(int argc, char ** argv){
        Gtk::Main kit(argc,argv);
        Gtk::Window* win=new Gtk::Window();
        kit.run(*win);
        return 0;
}

Compiles correctly, runs correctly (pops up window, exits
when window is closed)

When running under valgrind, an invalid read is detected.
GDB backtrace:

  • #0 vg_do_syscall3
    at vg_mylibc.c line 91
  • #1 ??
  • #2 SigC::Control_::destroy
    from /usr/lib/libsigc-1.1.so.5
  • #3 SigC::ObjectBase::~ObjectBase
    from /usr/lib/libsigc-1.1.so.5
  • #4 Gtk::Main::~Main
    from /usr/lib/libgtkmm-1.3.so.16
  • #5 main
    at other_test.cc line 7

This happens (obviously) after pressing the close button.
However, the program exits normally.

Tassos
Comment 1 Murray Cumming 2002-09-18 15:39:08 UTC
Confirmed on RH7.2 with gcc 2.96.
Comment 2 Murray Cumming 2002-09-19 09:01:29 UTC
Here's some fuller information, using --num-callers=20. This shows
what freed the memory that is being incorrectly read again later.

==25837== Invalid read of size 4
==25837==    at 0x404F7E85: SigC::Control_::destroy(void) (object.cc:72)
==25837==    by 0x404F8020: SigC::ObjectBase::~ObjectBase(void)
(object.cc:117)
==25837==    by 0x4044BD2C: Gtk::Main::~Main(void) (main.cc:360)
==25837==    by 0x8048CAC: main (main.cc:7)
==25837==    by 0x40938507: __libc_start_main
(../sysdeps/generic/libc-start.c:129)
==25837==    by 0x8048B81: Gtk::Main::Main(int, int &, char **&, bool)
(in
/gnome/gnome-2-0/cvs/c++/gtkmm-1.3/tests/delete_cpp_child/.libs/lt-test)
==25837==    by <bogus frame pointer> ???
==25837==    by <bogus frame pointer> ???
==25837==    Address 0x41F8BD3C is 36 bytes inside a block of size 44
free'd
==25837==    at 0x40040729: __builtin_delete (vg_clientfuncs.c:186)
==25837==    by 0x404F7C6E:
SigC::ObjectSlotNode::~ObjectSlotNode(void) (object_slot.cc:31)
==25837==    by 0x404F7077: SigC::Node::clear(void) const (node.cc:47)
==25837==    by 0x404F7290: SigC::SlotNode::notify(bool) (slot.cc:78)
==25837==    by 0x404F7C0F: SigC::ObjectSlotNode::notify(bool)
(object_slot.cc:24)
==25837==    by 0x404F7E85: SigC::Control_::destroy(void) (object.cc:72)
==25837==    by 0x404F8020: SigC::ObjectBase::~ObjectBase(void)
(object.cc:117)
==25837==    by 0x4044BD2C: Gtk::Main::~Main(void) (main.cc:360)
==25837==    by 0x8048CAC: main (main.cc:7)
==25837==    by 0x40938507: __libc_start_main
(../sysdeps/generic/libc-start.c:129)
==25837==    by 0x8048B81: Gtk::Main::Main(int, int &, char **&, bool)
(in
/gnome/gnome-2-0/cvs/c++/gtkmm-1.3/tests/delete_cpp_child/.libs/lt-test)
==25837==    by <bogus frame pointer> ???
==25837==    by <bogus frame pointer> ???
Comment 3 Murray Cumming 2002-09-19 09:12:33 UTC
This doesn't happen if you delete the Gtk::Window before the end of
main(). And you should do that. So I don't think this is a bug.
Comment 4 Murray Cumming 2002-09-19 17:01:13 UTC
Do you agree?
Comment 5 Tassos Bassoukos 2002-09-19 17:29:55 UTC
<ponders>... Ok.