[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Gtk callback segfaulter



Hej NG

Jeg er stødt ind i endnu et problem med mit gtk program.

Jeg har en knap som selvfølgelig kalder en callback funktion når den
bliver trykket på. Det spøjse er at når den har udført det den skal
så segfaulter den.

Callback funktionen:
void write_to_db(GtkWidget *widget, movieEntryWidgets * data){
  xmlDocPtr doc;
  movieEntry * movie_data;

  /* Allocate structure for movie_data */
  movie_data->title       = (gchar*)malloc(sizeof(gchar)*strlen(gtk_entry_get_text(GTK_ENTRY(data->title_entry))));
  movie_data->year        = (gchar*)malloc(sizeof(gchar)*strlen(gtk_entry_get_text(GTK_ENTRY(data->year_entry))));
  movie_data->imdb        = (gchar*)malloc(sizeof(gchar)*strlen(gtk_entry_get_text(GTK_ENTRY(data->imdb_entry))));
  movie_data->mediaformat = (gchar*)malloc(sizeof(gchar)*strlen(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(data->media_combo)->entry))));
  movie_data->mediasource = (gchar*)malloc(sizeof(gchar)*strlen(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(data->mediasource_combo)->entry))));
  movie_data->mediastored = (gchar*)malloc(sizeof(gchar)*strlen(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(data->mediastored_combo)->entry))));
  movie_data->medianumber = (gchar*)malloc(sizeof(gchar)*strlen(gtk_entry_get_text(GTK_ENTRY(data->number_of_media_entry))));
  movie_data->lentto      = (gchar*)malloc(sizeof(gchar)*strlen(gtk_entry_get_text(GTK_ENTRY(data->lentto_entry))));

  /* Setup data for structure */
  movie_data->title = gtk_entry_get_text(GTK_ENTRY(data->title_entry));
  movie_data->year = gtk_entry_get_text(GTK_ENTRY(data->year_entry));
  movie_data->imdb = gtk_entry_get_text(GTK_ENTRY(data->imdb_entry));
  movie_data->mediaformat = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(data->media_combo)->entry));
  movie_data->mediasource = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(data->mediasource_combo)->entry));
  movie_data->mediastored = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(data->mediastored_combo)->entry));
  movie_data->medianumber = gtk_entry_get_text(GTK_ENTRY(data->number_of_media_entry));
  movie_data->lentto = gtk_entry_get_text(GTK_ENTRY(data->lentto_entry));

  /* Delete Entry if exists */
  doc = delete_Movie("movies.xml", movie_data->title, movie_data->imdb);
  if (doc != NULL) {
    xmlSaveFormatFile ("movies.xml", doc, 0);
    xmlFreeDoc(doc);
  }
  
  /* Write edited entry or new entry */
  doc = write_form("movies.xml", movie_data);
  if (doc != NULL) {
    xmlSaveFormatFile ("movies.xml", doc, 0);
    xmlFreeDoc(doc);
  }
  
  printf("was here end\n");

  return;
}

Som sagt så når den at skrive was here end inden den segfaulter?? Alle
ideer er velkomne =)

mvh
Jesper


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *