My first experience of contribution to Cheese was a patch that intend to fix the bug: https://bugzilla.gnome.org/show_bug.cgi?id=647229
The first thing that I noticed was that this bug happens only when the user closes the Preferences dialog with the escape key... But, why? That happens because the GtkDialog has a "close" signal that by default is called when the escape key is released and as consequence it also triggers the "delete-event", that destroys the dialog.
After few research I discovered that exists a way to handle exactly this kind of issue. There is a method at GtkWidget called "gtk_widget_hide_on_delete()", so, what I did was connect this method with the handle of "delete-event" signal. This ensure that the escape key has the same result as the click on the "Close" button.
Here is the patch.