[gtkmm] Adjustment constructor seg faults



First I just wanted to say thanks for all of help with my previous
questions. I appreciate the tips and pointers that everyone's provided.
On to the next problem...

I've got a small program that demonstrates the problem. Simply put, it
segfaults in the constructor. I've sub-classed the Gtk::Adjustment and
in the Gtk::Adjustment::Adjustment(double....) constructor it calls some
other stuff and segfaults. Below I've got the program and the backtrace
I've done with gdb. I compile the program with this line:

g++ -g `pkg-config --cflags --libs gtkmm-2.0` src/test.cpp

I'm not sure if this is a bug, or something I'm doing wrong, so I havn't
yet submitted a bug report.

Again, any help is greatly appreciated.

#include <gtkmm/main.h>
#include <gtkmm/adjustment.h>

class adjust : public Gtk::Adjustment
{
  gint color_z;
  public:
    adjust(const gint & =0);
};

//Constructor.
adjust::adjust(const gint &mask)
: Gtk::Adjustment(0.0, 0.0, 1.5, 0.01, 0.1, 0.5), color_z(mask)
{
  cout << "adjust constructor.\n";
  gdouble a;
}

int main(int argc, char* argv[])
{
  Gtk::Main main_runner(argc, argv);
  adjust dud(2);
  main_runner.run();
  return(0);
}

(gdb) backtrace
#0  0x0 in __strtol_internal (nptr=0x806ffd0 "\230þ\006\b\002",
endptr=0x8063bc0, base=-1073746260, group=1079820466) at eval.c:35
#1  0x400e56d8 in Gtk::Adjustment_Class::changed_callback () at
eval.c:88
#2  0x405cc132 in g_cclosure_marshal_VOID__VOID () at eval.c:88
#3  0x405b73bc in g_type_class_meta_marshal () at eval.c:88
#4  0x405b6eeb in g_closure_invoke () at eval.c:88
#5  0x405cadf2 in signal_emit_unlocked_R () at eval.c:88
#6  0x405c9b70 in g_signal_emit_valist () at eval.c:88
#7  0x4033596f in gtk_signal_emit () at eval.c:88
#8  0x40273442 in gtk_adjustment_changed () at eval.c:88
#9  0x400e5e36 in Gtk::Adjustment::changed () at eval.c:88
#10 0x400e557d in Gtk::Adjustment::Adjustment () at eval.c:88
#11 0x8049ff9 in adjust::adjust (this=0xbffff460, __in_chrg=1,
mask= 0xbffff45c) at src/test.cpp:31
#12 0x804a10a in main (argc=1, argv=0xbffff504) at src/test.cpp:40
#13 0x407bb906 in __libc_start_main (main=0x804a0cc <main>, argc=1,
ubp_av=0xbffff504, init=0x8049bf8 <_init>, fini=0x804b110 <_fini>, 
    rtld_fini=0x4000b5f0 <_dl_fini>, stack_end=0xbffff4fc) at
../sysdeps/generic/libc-start.c:129

-- 
MACINTOSH = Machine Always Crashes If Not The Operating System Hangs
"Life would be so much easier if we could just look at the source code."
- Dave Olson
"Conan, what is good in life?" "To crush your enemies, see them driven
before you,
and to hear the lamentations of their women"




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]