I wrote a small test application to check the behavior of gdk_pixbuf_new_from_stream. It writes two pixbufs into a stream and then tries to read them. png is used as format. The first png is loaded as expected. But the second is not. Other reading operations fail, too. The stream isn't readable any longer after gdk_pixbuf_new_from_stream. That's a big problem, because this is the most important part of my nearly finished application. Any ideas what I can do about it? gtk version is 2.18.6 #include <gdk-pixbuf/gdk-pixbuf.h> #include <gio/gio.h> #include <stdlib.h> gint main(void) { GError * error = NULL; GFile * file; GFileOutputStream * output_stream; GFileInputStream * input_stream; GdkPixbuf * pixbuf; gboolean ret; g_type_init(); file = g_file_new_for_path("./test.dat"); output_stream = g_file_replace(file, NULL, FALSE, 0, NULL, &error); if (output_stream == NULL) { g_printerr("%s\n", error->message); exit(EXIT_FAILURE); } pixbuf = gdk_pixbuf_new_from_file("test.png", &error); if (pixbuf == NULL) { g_printerr("%s\n", error->message); exit(EXIT_FAILURE); } ret = gdk_pixbuf_save_to_stream(pixbuf, G_OUTPUT_STREAM(output_stream), "png", NULL, &error, NULL); if (ret == FALSE) { g_printerr("%s\n", error->message); exit(EXIT_FAILURE); } ret = gdk_pixbuf_save_to_stream(pixbuf, G_OUTPUT_STREAM(output_stream), "png", NULL, &error, NULL); if (ret == FALSE) { g_printerr("%s\n", error->message); exit(EXIT_FAILURE); } g_output_stream_close(G_OUTPUT_STREAM(output_stream), NULL, NULL); input_stream = g_file_read(file, NULL, &error); if (input_stream == NULL) { g_printerr("%s\n", error->message); exit(EXIT_FAILURE); } g_object_unref(pixbuf); pixbuf = gdk_pixbuf_new_from_stream(G_INPUT_STREAM(input_stream), NULL, &error); if (pixbuf == NULL) { g_printerr("1st read: %s\n", error->message); exit(EXIT_FAILURE); } g_object_unref(pixbuf); pixbuf = gdk_pixbuf_new_from_stream(G_INPUT_STREAM(input_stream), NULL, &error); if (pixbuf == NULL) { g_printerr("2nd read: %s\n", error->message); exit(EXIT_FAILURE); } g_input_stream_close(G_INPUT_STREAM(input_stream), NULL, NULL); exit(EXIT_SUCCESS); } file content after the writing operations: 00000000 89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52 .PNG........IHDR 00000010 00 00 00 10 00 00 00 10 08 02 00 00 00 90 91 68 ...............h 00000020 36 00 00 00 03 73 42 49 54 08 08 08 DB E1 4F E0 6....sBIT.....O. 00000030 00 00 00 40 49 44 41 54 28 91 63 60 20 11 30 32 ...@IDAT(.c` .02 00000040 30 30 EC 2B 20 56 B5 D3 04 06 16 06 06 86 A6 6D 00.+ V.........m 00000050 0C 6E 9A 84 55 5B 28 32 30 30 30 30 91 EA A4 51 .n..U[(20000...Q 00000060 0D 23 45 03 23 03 03 83 83 1A B1 AA 0F DC 22 D5 .#E.#.........". 00000070 7C 06 06 00 81 CA 06 1D 01 B7 D6 31 00 00 00 00 |..........1.... 00000080 49 45 4E 44 AE 42 60 82 89 50 4E 47 0D 0A 1A 0A IEND.B`..PNG.... 00000090 00 00 00 0D 49 48 44 52 00 00 00 10 00 00 00 10 ....IHDR........ 000000A0 08 02 00 00 00 90 91 68 36 00 00 00 03 73 42 49 .......h6....sBI 000000B0 54 08 08 08 DB E1 4F E0 00 00 00 40 49 44 41 54 T.....O....@IDAT 000000C0 28 91 63 60 20 11 30 32 30 30 EC 2B 20 56 B5 D3 (.c` .0200.+ V.. 000000D0 04 06 16 06 06 86 A6 6D 0C 6E 9A 84 55 5B 28 32 .......m.n..U[(2 000000E0 30 30 30 30 91 EA A4 51 0D 23 45 03 23 03 03 83 0000...Q.#E.#... 000000F0 83 1A B1 AA 0F DC 22 D5 7C 06 06 00 81 CA 06 1D ......".|....... 00000100 01 B7 D6 31 00 00 00 00 49 45 4E 44 AE 42 60 82 ...1....IEND.B`. _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list