古いクラッターコードのキャストを整理して、最新の状態にしようとすると問題が発生します。次のようなコードがあります。
static void image_init(CtkImage *image)
{
priv->texture = clutter_texture_new ();
...
}
static void refresh_icon (CtkImage *image)
{
CtkImagePrivate *priv = image->priv;
gtk_clutter_texture_set_from_pixbuf (CLUTTER_TEXTURE (priv->texture), priv->pixbuf, NULL);
}
これにより、次のコンパイル時エラーが発生します。
error: passing argument 1 of ‘gtk_clutter_texture_set_from_pixbuf’ from incompatible pointer type [-Werror]
/usr/include/clutter-gtk-1.0/clutter-gtk/gtk-clutter-texture.h:99:17: note: expected ‘struct GtkClutterTexture *’ but argument is of type ‘struct ClutterTexture *’
GTK_CLUTTER_TEXTUREを使用して修正できると思いました。これはコンパイルされますが、実行時エラーが発生し、pixbufsが不足しています。
gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE (texture), tiled, NULL);
その結果:
GLib-GObject-WARNING **: invalid cast from `ClutterTexture' to `GtkClutterTexture'
Clutter-Gtk-CRITICAL **: gtk_clutter_texture_set_from_pixbuf: assertion `GTK_CLUTTER_IS_TEXTURE (texture)' failed
何が起こっているのですか、そしてなぜこれが失敗するのですか?どうすればデバッグできますか?