erreur du serveur x après un "gtk_widget_show_all"
Bonjour à tous,
J'assaie de faire une application affichant une fenêtre principale (jusqu'ici tout va bien), elle affiche aussi une fenêtre d'attente pendant une transmission sur le port série avec ceci
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
void StartWait(char event)
{
cancel = false;
Window_wait = gtk_dialog_new();
gtk_window_set_title(GTK_WINDOW(Window_wait), g_strdup_printf("transmission en cours"));
switch(event)
{
case cConf :
text_wait = gtk_label_new("veuillez patienter pendant la configuration de la sonde");
break;
case cCancel_Conf :
text_wait = gtk_label_new("veuillez patienter pendant l'annulation des modifications");
break;
case cIgnor_New :
text_wait = gtk_label_new("veuillez patienter pendant la configuration du coordinateur");
break;
case cAdd_Probe :
text_wait = gtk_label_new("veuillez patienter pendant l'ajout de la sonde");
break;
case cRemove_Probe :
text_wait = gtk_label_new("veuillez patienter pendant la suppression de la sonde");
break;
case cPurge_Rejected :
text_wait = gtk_label_new("veuillez patienter pendant la suppression de la liste");
break;
default :
text_wait = gtk_label_new("je ne sais pas ce que j'attends mais j'attends, il y a un bug");
break;
}
spinner_wait = gtk_image_new_from_file("images/patienter.gif");
cont_wait = gtk_vbox_new(1, 0);
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area (GTK_DIALOG(Window_wait))), cont_wait);
gtk_container_add(GTK_CONTAINER(cont_wait), text_wait);
gtk_container_add(GTK_CONTAINER(cont_wait), spinner_wait);
gtk_widget_show_all(Window_wait);
} |
Ca va toujours.
Ensuite quand la transmission est finie, j'appelle la fonction suivante pour détruire la précédente et en créer une nouvelle pour dire que tout s'est bien passé (ou que l'ordinateur va s'autodétruire) :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
void CancelWaitGeneric(const char* title, const char* text)
{
lock_wait_window();
if(cancel == false)
{
cancel = true;
UpdateAll();
if(GTK_IS_WINDOW(Window_wait))
{
gtk_widget_destroy (Window_wait);
}
Window_end = gtk_dialog_new_with_buttons(title,
GTK_WINDOW(sGVar.MainWindow),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
text_end = gtk_label_new(text);
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area (GTK_DIALOG(Window_end))), text_end);
printf("connect\n");
g_signal_connect(G_OBJECT(Window_end), "response", G_CALLBACK(CloseWindow_end), NULL);
// g_signal_connect(G_OBJECT(Window_end), "delete-event", G_CALLBACK(CloseWindow_end), NULL);
printf("end connect : showing now\n");
gtk_widget_show_all(Window_end);
printf("showed\n");
}
unlock_wait_window();
}
} |
Et là, je vois sur la console :
Citation:
connect
end connect : showing now
(probes:10034): Gdk-WARNING **: The program 'probes' received an X Window System error.
This probably reflects a bug in the program.
The error was 'RenderBadPicture (invalid Picture parameter)'.
(Details: serial 3424 error_code 163 request_code 149 minor_code 7)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Pour info, CloseWindow_end :
Code:
1 2 3 4 5 6
|
{
printf("close wait window\n");
gtk_widget_destroy(Window_end);
printf("end close wait_window\n");
} |
Le crash ne survient pas toujours.
L'erreur du serveur x apparaît dans les bug 810882, 810767 et autres doublons mais pour le logiciel gnome-settings-daemon.
J'ai essayé de ne pas supprimer la première fenêtre mais de la modifier pour avoir la seconde (en supprimant le spinner, modifiant le texte et en ajoutant des boutons) mais là, parfois elle se fige, comme si la fonction de callback n'était pas appelée.
Quelqu'un a-t-il une idée ? je sèche vraiment là, l'affichage semble indiquer que le crash se fait au moment du "gtk_widget_show_all(Window_end)", j'execute mon programme avec l'option --sync.
configuration : gtk3.0, debian squeeze.
Merci beaucoup