Gtk--, set_name()object types, and those warning messages



Well, there seems to be a small bug in Gtk--.

In widget.gen_h, we have:

void Gtk_Widget_Class::style_set_c_callback(GtkWidget *o, GtkStyle *p1) 
{
  CppObjectType *obj=static_cast<CppObjectType *>(gtk_object_get_data(GTK_OBJECT(o),"cpp"));
  g_return_if_fail(obj);
  if (obj) {
    // try to use signal with Gtk_Widget argument if available, else with GtkWidget
    if(p1) {
      Gtk_Style *warg = (Gtk_Style*)gtk_object_get_data(GTK_OBJECT(p1),"cpp");
      if(warg)
	obj->style_set(warg);
      else
	obj->style_set_c_impl(p1);
    } else
      obj->style_set_c_impl(p1);
  } //else {
  //  sigs_bk->style_set_c(o,p1);
  //}
  
  return;
}

If you end up calling this from this:

      string someWidgetName;

      Gtk_Widget->set_name (someWidgetName);

then sometimes, for reasons I don't understand (*), the p1 argument is of
type GTK_TYPE_CHAR, and is therefore not an object. This means that
the lookup in gtk_object_get_data() will produce a warning, even
though the result of the call to set_name() will be successful,
presumably because we use the C level style set function.

Any comments anyone ?

--p

(*) although I'll hazard a guess. This seems to happen whenever an object
    is having its style reset from the default widget style, which it
    picked up c/o being packed into a container. I'm guessing that something
    about the way the default widget style is defined by me in an rc file,
    or used/set up in GTK+ is responsible. This only seems to happen
    after I've packed an object into a container, and then I reset its
    name.



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