Fork with gtk+-2.0



Hi,
 
I have developed an app using glade with gtk+-2.0. From one of the button click callbacks I want to fork a process (a software keyboard xvkbd). I have tried fork/execlp and g_spawn* functions but all result in a seg fault. Follwing is a gdb session
 

(gdb) list on_button_clicked

991

992

993 void

994 on_button_clicked (GtkButton *button,

995 gpointer user_data)

996 {

997 pid_t pid;

998

999 pid = fork();

1000

(gdb) list

1001 if( pid == -1 )

1002 g_print("Fork failed\n");

1003 else

1004 if( pid == 0 )

1005 execlp("/bin/xvkbd", "-geometry 800x185-0-0", NULL);

1006

1007

1008 }

1009

1010

(gdb) break 999

Breakpoint 1 at 0x8060e0a: file callbacks.c, line 999.

(gdb) break 1004

Breakpoint 2 at 0x8060e14: file callbacks.c, line 1004.

(gdb) run

Starting program: /Projects/project3/src/project3

[New Thread 16384 (LWP 2160)]

[Switching to Thread 16384 (LWP 2160)]

Breakpoint 1, on_button_clicked (button=0x8099be8, user_data=0x0) at callbacks.c:999

999 pid = fork();

(gdb) continue

Continuing.

Program received signal SIGSEGV, Segmentation fault.

0x00000000 in ?? ()

(gdb)

 

But I can't make anything of it. Can anyone please suggest what is wrong and how to rectify it.

PS: I have used g_spawn* functions of glib-2.0 but they also result in a similar behaviour.

 

Regards


Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003

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