Gtk--: Having Trouble with Initialization Lists



I'm not certain yet whether this problems is caused by my unfamiliarty
with Gtk-- or my unfamiliarity with C++, but I thought I'd check here
first and see what suggestions anyone might have. :)

I have created a class based on Gtk_Window. I have added a button, a
label, and some boxes to hold them (code fragment follows.) I have
other boxes, clists and labels I need to add, but here's the problem:
adding the xref_label and initializing it as shown below causes a
segfault. None of the variables that I initialize are defined at all
in this case. commenting out the xref_label parts allows it to
work. Also, leaving the xref_label in while commenting out the
done_button portions also works! It seems like I can initialize 4
variables, but not 5. 

I've RTFMed, surfed the web, and banged my head against the keyboard,
but I can't spot the problem. Can anyone help?

class KExtInfo : public Gtk_Window
{
 private:
  Gtk_Button done_button;       // Done button
  Gtk_HBox outside_hbox;        // Outside of dialog
  Gtk_VBox r_vbox;              // Right side of box
  Gtk_VBox l_vbox;              // Left side of box
  Gtk_Label xref_label;         // Cross reference list

  void donebuttonpressed(void) { hide(); }

 public:
  KExtInfo(void);
};

KExtInfo::KExtInfo(void)
  : Gtk_Window(GTK_WINDOW_TOPLEVEL),
    done_button("Done"),
    outside_hbox(FALSE, 0),
    r_vbox(FALSE, 0),
    l_vbox(FALSE, 0),
    xref_label("Crossreferences:")
{
  set_usize(500, 300);
  set_policy(FALSE, FALSE, FALSE);

  connect_to_method(done_button.pressed, this, &donebuttonpressed);
  r_vbox.pack_start(&done_button, FALSE, FALSE, 0);
  r_vbox.pack_start(&xref_label, FALSE, FALSE, 0);

  outside_hbox.pack_start(&l_vbox, FALSE, FALSE, 0);
  outside_hbox.pack_start(&r_vbox, FALSE, FALSE, 0);

  add(&outside_hbox);
  outside_hbox.show();
  l_vbox.show();
  r_vbox.show();
  done_button.show();
  xref_label.show();
}

Steve Baker <ssbaker@primenet.com> | kiku wa ittoki no haji
            <stbak@aol.com>        | kikanu wa matsudai no haji 



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