GNOME Bugzilla – Bug 68592
Memory Corruption in GtkText widget
Last modified: 2004-12-22 21:47:04 UTC
Hi, when i code something like... --------------------------------------------------------------------------- int sockfd; // socket file descriptor EVERITHING IN UNIX IS A FILE MEN! :-) gtk_text_insert((GtkText *)Texto,NULL,NULL,NULL,"Connecting to SMTP server:\n",50); //gtk_text_insert((GtkText *)Texto,NULL,NULL,NULL,(gchar *)ServerAddress,40); if ((sockfd = Stablish_connection(PMail->ServerAddress)) == -1){ gtk_text_insert((GtkText *)Texto,NULL,NULL,NULL,"Couldn't connect to server\n",60); printf("PROBLEM CONNECTING\n"); gtk_text_insert((GtkText *)Texto,NULL,NULL,NULL,(gchar *)PMail->ServerAddress,40); } else { gtk_text_insert((GtkText *)Texto,NULL,NULL,NULL,"Connection Stablished Successfully\n",60); if ((Login(sockfd)) == 0){ gtk_text_insert((GtkText *)Texto,NULL,NULL,NULL,"Logged successfully\n",60); } } --------------------------------------------------------------------------- and i run the program, the GtkText box writes "Couldn't connect to servLogged successfully" even if the connection was stablished with the server. (i debugged it thousands of times and the program never goes to the line containing "Couldn't connect to server". In some cases, GtkText, writes inside it, what printf should write! HAHA like for example "PROBLEM CONNECTING\n" that is written by a printf... I dunno what's happening, but i hope my bug report be useful for you. OK Thank you. Pablo Tomas Borda Di Berardino
You're passing in the wrong lengths for your strings. Use -1 for GTK to determine the length automatically.