开发者

GdkPixbuf Collection

开发者 https://www.devze.com 2023-01-06 06:49 出处:网络
I need to create GdkPixBuf collection. I try to save pixbufs in GList -mw->disp_list: GtkTreeIter iter;

I need to create GdkPixBuf collection. I try to save pixbufs in GList - mw->disp_list:

GtkTreeIter iter;
int i = 0;

for (i; i < g_list_length(list) - 1; ++i)
{                       
  char* file = image_list_get_current_file_path( list );

  mw->p1 = gdk_pixbuf_new_from_file(fi开发者_高级运维le,NULL);
  mw->p1 = scale_pix(mw->p1,128);

  mw->disp_list = g_list_append (mw->disp_list, mw->p1);

  if (!mw->img_list->current->next )
      image_list_get_first(mw->img_list);
  else
      image_list_get_next(mw->img_list);
}

Where p1 - it's GtkPixBuf*.

But when i try to use mw->disp_list in another function i see that it is NULL. What's wrong?

Thank you.


At the moment I see just one problem, and it is about the loop that should be:

for (i = 0; i < g_list_length(list); ++i)

The problem could be the -1: if list contains 1 element, you do not loop at all, since 1-1 = 0 and 0 < 0 is false.

0

精彩评论

暂无评论...
验证码 换一张
取 消