Ethereal-dev: Re: [Ethereal-dev] Some Gtk and compiler warnings

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 7 Jan 2004 13:31:09 -0800

On Jan 7, 2004, at 12:59 PM, Olivier Biot wrote:

If I open the "Save As" menu item, I get the following warnings:
GLib-GObject-WARNING **: invalid cast from GtkFrame to GtkBox
GTK-CRITICAL **: file ../../gtk+2.2.1/gtk/gtkbox.c: line 371
(gtk_box_pack_start): assertion GTK_IS_BOX (box) failed

"file_save_as_cmd_cb()" does:

  /*** Packet Range frame ***/
  range_fr = gtk_frame_new("Packet Range");
  gtk_box_pack_start(GTK_BOX(main_vb), range_fr, FALSE, FALSE, 0);
  gtk_widget_show(range_fr);

  /* range table */
  range_tb = gtk_table_new(7, 3, FALSE);
  gtk_container_border_width(GTK_CONTAINER(range_tb), 5);
  gtk_box_pack_start(GTK_BOX(range_fr), range_tb, FALSE, FALSE, 0);
  gtk_container_add(GTK_CONTAINER(range_fr), range_tb);
  gtk_widget_show(range_tb);

GTK_BOX(range_fr) isn't valid - a GtkFrame is not a GtkBox (GtkFrame is not a subclass of GtkBox).

A GtkFrame is also a GtkBin (GtkFrame is a subclass of GtkBin), which is also a GtkContainer; the right call is probably a "gtk_container_add()" call - which we're already doing, so the "gtk_box_pack_start()" call should just be removed. I've checked in a change to remove it.