prevent the child watcher from accessing already released memory after the
2007-02-26 Jens Granseuer <jensgr@gmx.net> * gnome-about-me-password.c: (stop_passwd), (child_watch_remove), (free_passwd_resources): prevent the child watcher from accessing already released memory after the dialog has been closed (should fix bug #411697) * gnome-about-me-password.c: (gnome_about_me_password): unref dialog when we're done * gnome-about-me.c: (about_me_setup_dialog): remove redundant warning svn path=/trunk/; revision=7338
This commit is contained in:
parent
43bb23a860
commit
9ff02af06c
3 changed files with 34 additions and 10 deletions
|
@ -1,3 +1,14 @@
|
|||
2007-02-26 Jens Granseuer <jensgr@gmx.net>
|
||||
|
||||
* gnome-about-me-password.c: (stop_passwd), (child_watch_remove),
|
||||
(free_passwd_resources): prevent the child watcher from accessing
|
||||
already released memory after the dialog has been closed (should fix
|
||||
bug #411697)
|
||||
|
||||
* gnome-about-me-password.c: (gnome_about_me_password): unref dialog
|
||||
when we're done
|
||||
* gnome-about-me.c: (about_me_setup_dialog): remove redundant warning
|
||||
|
||||
2007-02-25 Jens Granseuer <jensgr@gmx.net>
|
||||
|
||||
Patch by: Diego Escalante Urrelo <diego@aureal.com.pe>
|
||||
|
|
|
@ -134,6 +134,9 @@ enum {
|
|||
static void
|
||||
stop_passwd (PasswordDialog *pdialog);
|
||||
|
||||
static void
|
||||
child_watch_remove (PasswordDialog *pdialog);
|
||||
|
||||
static void
|
||||
free_passwd_resources (PasswordDialog *pdialog);
|
||||
|
||||
|
@ -270,18 +273,34 @@ stop_passwd (PasswordDialog *pdialog)
|
|||
* If we return this way we can safely kill passwd as it has completed
|
||||
* its task.
|
||||
*
|
||||
* Maybe we should run free_passwd_resources here first, and not let
|
||||
* our child watcher do it?
|
||||
* We must run free_passwd_resources here and not let our child
|
||||
* watcher do it, since it will access invalid memory after the
|
||||
* dialog has been closed and cleaned up.
|
||||
*/
|
||||
|
||||
if (pdialog->backend_pid != -1) {
|
||||
child_watch_remove (pdialog);
|
||||
kill (pdialog->backend_pid, 9);
|
||||
free_passwd_resources (pdialog);
|
||||
}
|
||||
|
||||
/* Our child_watch_cb should now handle our kill signal,
|
||||
* run waitpid and call free_passwd_resources appropriately. */
|
||||
}
|
||||
|
||||
/* Remove the child watcher only */
|
||||
static void
|
||||
child_watch_remove (PasswordDialog *pdialog)
|
||||
{
|
||||
/* Remove IO watcher */
|
||||
if (pdialog->backend_stdout_watch_id != 0) {
|
||||
|
||||
g_source_remove (pdialog->backend_stdout_watch_id);
|
||||
|
||||
pdialog->backend_stdout_watch_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up passwd resources */
|
||||
static void
|
||||
free_passwd_resources (PasswordDialog *pdialog)
|
||||
|
@ -315,13 +334,7 @@ free_passwd_resources (PasswordDialog *pdialog)
|
|||
pdialog->backend_stdout = NULL;
|
||||
}
|
||||
|
||||
/* Remove IO watcher */
|
||||
if (pdialog->backend_stdout_watch_id != 0) {
|
||||
|
||||
g_source_remove (pdialog->backend_stdout_watch_id);
|
||||
|
||||
pdialog->backend_stdout_watch_id = 0;
|
||||
}
|
||||
child_watch_remove (pdialog);
|
||||
|
||||
/* Close PID */
|
||||
if (pdialog->backend_pid != -1) {
|
||||
|
@ -1093,5 +1106,6 @@ gnome_about_me_password (GtkWindow *parent)
|
|||
stop_passwd (pdialog);
|
||||
gtk_widget_destroy (wpassdlg);
|
||||
g_queue_free (pdialog->backend_stdin_queue);
|
||||
g_object_unref (dialog);
|
||||
g_free (pdialog);
|
||||
}
|
||||
|
|
|
@ -754,7 +754,6 @@ about_me_setup_dialog (void)
|
|||
"about-me-dialog", NULL);
|
||||
|
||||
if (dialog == NULL) {
|
||||
g_warning ("Unable to load glade file.");
|
||||
about_me_destroy (me);
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue