gtk_main_quit () problem
- From: Andreas Volz <andreas brachttal net>
 
- To: gtk-app-devel-list gnome org
 
- Subject: gtk_main_quit () problem
 
- Date: Sat, 16 Nov 2002 20:48:27 +0000
 
Hy,
I've written a simple gtk2-application (my first ;-). It works, but it
has problems while exiting.
Event function 1 is connected to a button (clicked) and works great.
Event function 2 is connected to an entry (activate) and works too but
returns a "Segmentation fault" to the xterm. Where is my problem?
Perhaps this problem is not gtk specific. But I hope someone could point
me to the error.
Thanks
Andreas
/* event function1 */
void cancel( GtkWidget *widget,  gpointer data )
{
  gtk_main_quit ();
}
/* event function 2*/
void run (GtkWidget *widget, GtkWidget *entry )
{
  const gchar *entry_text;
  gchar *parm;
  gchar **parmv;
  gint parm_counter = 0;
  gint ret_val;
 
  entry_text = gtk_entry_get_text (GTK_ENTRY (entry));
  if (!(strcmp (entry_text, "")))
    return;
  /* tokenize the sting in all arguments */
  parm = strtok ( (char*) entry_text, (const char*) " ");
  while (parm != NULL)
  {
    parmv[parm_counter] = parm;
    parm = strtok (NULL, (const char*) " ");
    parm_counter++;
  }
  parmv[parm_counter] = (void*) NULL;
  if (parmv[0] == NULL)
    return;
  /* execute the process with all args */
  ret_val = execvp (parmv[0], parmv);
  
  /* exit if the process couldn't start */
  if (ret_val == -1)
  {
    g_print ("Exit\n");
    gtk_main_quit ();         /* This returns a "Segmentation fault".
But Why?*/
  }
}
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]