GNOME Bugzilla – Bug 700856
sound: "Test Speakers" dialogue still shown when panel changed
Last modified: 2013-06-04 11:01:02 UTC
When the g-c-c panel is changed from Sound to another panel whilst the Test Speakers dialog is still open (i.e. user activates a panel via one of the Shell indicators) the dialog remains shown and modal for the g-c-c window.
Created attachment 245081 [details] [review] Patch to ensure dialogue is closed when panel changed from Sound
Review of attachment 245081 [details] [review]: ::: panels/sound/gvc-mixer-dialog.c @@ +1536,3 @@ static void +on_dialog_closed (GObject *source, + gpointer user_data) The "destroy" signal prototype has GtkWidget as the first parameter. @@ +1540,3 @@ + GtkWidget *d; + + if (user_data == NULL || !GTK_IS_WIDGET (user_data)) This check should be necessary because the signal must be disconnected if the speaker test dialog has been destroyed (see below). @@ +1552,3 @@ + gpointer user_data) +{ + if (dialog != NULL && GTK_IS_DIALOG (dialog)) dialog is the object that emits the signal, so this check will always evaluate to true. @@ +1631,1 @@ gtk_dialog_run (GTK_DIALOG (d)); The "destroy" signal handler needs disconnecting after the test speakers dialog has been destroyed, otherwise a dangling pointer will be passed to on_dialog_closed. I don't think the "response" signal needs to be connected here. Emitting the response signal using gtk_dialog_response rather than destroying dialog in on_dialog_closed should be sufficient.
Created attachment 245208 [details] [review] Patch attempt 2 Thanks for the review Thomas. I've attached a cleaned up version here which I believe follows the spirit of your review.
Created attachment 245975 [details] [review] Cleaner version of the patch Thomas rightly pointed out that other panels do something similar in a much cleaner way, by ensuring the dialog is handled appropriately in the panels dispose method. This patch follows that pattern.