Fwd: Segmentation fault in g_main_context_prepare()

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

 



Thanks Sebastien for fixing my problem.


---------- Forwarded message ----------
From: Sébastien Wilmet <sebastien.wilmet@xxxxxxxxx>
Date: Sat, Mar 13, 2010 at 5:13 AM
Subject: Re: Segmentation fault in g_main_context_prepare()
To: hap 497 <hap497@xxxxxxxxx>


2010/3/13 hap 497 <hap497@xxxxxxxxx>
>
> Hi,
>
> I have a Gtk application. It runs when when I launch it at command
> prompt in a shell.
> But when I try to launch it from another C program, like this:
>
> int main( int argc, const char* argv[] )
> {
>    char *args[2] = { "testarg", 0 };
>    char *envp[1] = { 0 };
>    execve("/home/michael/MyGtkApp",args,envp);
> }
>
> My program crashes with this.
> Program received signal SIGSEGV, Segmentation fault.
> 0x007e5f4e in g_main_context_prepare () from /lib/libglib-2.0.so.0
> (gdb) bt
> #0  0x007e5f4e in g_main_context_prepare () from /lib/libglib-2.0.so.0
> #1  0x007e6351 in ?? () from /lib/libglib-2.0.so.0
> #2  0x007e6b9f in g_main_loop_run () from /lib/libglib-2.0.so.0
> #3  0x0041b419 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
> #4  0x08049191 in main (argc=1, argv=0xbffffed4)
>    at main.c:471
>
> Does anyone has any idea?
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> http://mail.gnome.org/mailman/listinfo/gtk-list

 Hi,

args[0] must contain the binary.
And the last values of args and anvp must be NULL, but maybe it works
with 0 too.
So try this:

int main( int argc, const char* argv[] )
{
   char *args[2] = { "/home/michael/MyGtkApp", "testarg", NULL };
   char *envp[1] = { NULL };
   execve("/home/michael/MyGtkApp",args,envp);
}
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux