GNOME Bugzilla – Bug 682658
GParted crash by pressing Esc in dialogs with number entry
Last modified: 2012-10-10 16:50:42 UTC
While doing some testing in GParted I came across this crash. I have confirmed it exists in GParted 0.7.0, 0.12.0 and 0.13.0-git on Fedora 14 & 16. Reproduction steps: 1) Create a new partition to open the "Create New Partition" dialog 2) Update "New size" field entering a new number using the keyboard 3) Press [Esc] key GParted crashes. Doesn't crash when just clicking into the number field and pressing [Esc]. Also crashes in other dialogs with number entry fields too, but not all. So far can trigger crashes in: Dialog: Create New Partition Fields: Free space preceding New size Free space following Dialog: Resize/Move Fields: Free space preceding New size Free space following Dialog: Paste (into new partition from unallocated space) Fields: Free space preceding New size Free space following But no crash in: Dialog: Resize/Move Fields: New size Dialog: Paste (into new partition from unallocated space) Fields: New size Thanks, Mike
Thank you Mike for this report. Using the reproduction steps I have confirmed this problem under Ubuntu 11.04. I'm just back from visiting family so it might be a day or two before I can catch up on this and other reports.
My debugging from testing New Partition dialog: ... D: Dialog_Base_Partition::Set_MinMax_Text(min=1, max=12830) D: this=0xbf9b537c D: Dialog_Base_Partition::on_spinbutton_value_changed(spinbutton=SIZE) D: this=0xbf9b537c D: Dialog_Base_Partition::on_spinbutton_value_changed(spinbutton=BEFORE) D: this=0xbf9b537c D: Dialog_Base_Partition::Check_Change() D: this=0xbf9b537c D: Dialog_Base_Partition::Check_Change() D: this=0xbf9b537c << Use keyboard to enter different figure into Free space preceding and press [Esc] >> D: Dialog_Base_Partition::~Dialog_Base_Partition() D: this=0xbf9b537c D: Dialog_Base_Partition::on_spinbutton_value_changed(spinbutton=BEFORE) D: this=0xbf9b537c D: Dialog_Base_Partition::on_spinbutton_value_changed(spinbutton=SIZE) D: this=0xbf9b537c Segmentation fault Coding GTK widgets is brand new to me, but this is what I think is happening: 1) Dialog_Base_Partition() constructor is connecting value change signal handles in the GTK widget to call back to on_spinbutton_value_changed(). 2) If you use the up and down buttons, or enter numbers via the keyboard and press [Tab] the on_spinbutton_value_changed() gets called to update the objects internal figures and everything works. 3) If you enter a number via the keyboard and press [Esc] the ~Dialog_Base_Partition() destructor is called first, deleting the dialog object. Then the value changed call backs get call on the object which no longer exists. Hey presto; crash. And to fix it I think that the destructor needs to disconnect the on change call back. I don't *yet* know how to fix this.
Created attachment 222774 [details] [review] Fix for bug 682658 So here's what I think is the correct fix.
Created attachment 222926 [details] [review] Fix for bug 682658 (v2) D'oh! Fix commit summary. Remove second "with". < Prevent crash from pressing Esc in dialogs with with number entry (#682658) --- > Prevent crash from pressing Esc in dialogs with number entry (#682658)
Hi Mike, From my testing this patch fixes the problem. :-) One other dialog where data can be input from the keyboard occurs when using "Partition --> Label". Typing text for a label and then pressing the ESCape key seems to work properly, so I think the problem is related to keyboard entry widgets with signal connections only. This bug fix has been committed to the git repository for inclusion in the next release of GParted. The relevant commit can be viewed at the following link: http://git.gnome.org/browse/gparted/commit/?id=87625c2b0afea2930109aae52cc23e18e08e590b
This bug fix has been included in GParted 0.14.0 released on October 10, 2012.