reading GIOChannel causes "Segmentation fault"



Hi,
when running the following piece of code, i get a "Segmentation fault"
error.

(009)   Client::Client() {
..
(012)     pipe(fdFromDonkey);
..
(016)     pidDonkey = fork();
(017)     if (pidDonkey == 0) {
..
(023)       dup2(fdFromDonkey[1], fileno(stdout));
..
(028)       close(fdFromDonkey[0]);
..
(031)       gchar *argvDonkey[1] = NULL;
(032)       gchar **argvDonkeyPointer = argvDonkey;
(033)       execv("./donkey",argvDonkeyPointer);
..
(036)     }
..
(040)     fromDonkey = g_io_channel_unix_new(fdFromDonkey[1]);
..
(043)     g_io_add_watch(fromDonkey, G_IO_IN, parseText, this);
..
(045)   }


(056)   gboolean parseText(GIOChannel *source, GIOCondition condition,
                           gpointer client) {
(057)     guint *readBytes;
(058)     gchar *buffer;
..
(064)     g_io_channel_read(source, buffer, 1, readBytes);
..
(071)     return false;
(072)   }

When my program reaches line (064), it tells me "Segmentatio fault" and
exits. Why does this happen?

--
sven





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