After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 682658 - GParted crash by pressing Esc in dialogs with number entry
GParted crash by pressing Esc in dialogs with number entry
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
GIT HEAD
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2012-08-25 11:46 UTC by Mike Fleetwood
Modified: 2012-10-10 16:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix for bug 682658 (3.06 KB, patch)
2012-08-29 14:07 UTC, Mike Fleetwood
none Details | Review
Fix for bug 682658 (v2) (3.06 KB, patch)
2012-08-30 11:28 UTC, Mike Fleetwood
none Details | Review

Description Mike Fleetwood 2012-08-25 11:46:51 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
Comment 1 Curtis Gedak 2012-08-28 21:02:40 UTC
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.
Comment 2 Mike Fleetwood 2012-08-29 09:36:28 UTC
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.
Comment 3 Mike Fleetwood 2012-08-29 14:07:41 UTC
Created attachment 222774 [details] [review]
Fix for bug 682658

So here's what I think is the correct fix.
Comment 4 Mike Fleetwood 2012-08-30 11:28:03 UTC
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)
Comment 5 Curtis Gedak 2012-08-30 19:18:00 UTC
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
Comment 6 Curtis Gedak 2012-10-10 16:50:42 UTC
This bug fix has been included in GParted 0.14.0 released on October 10, 2012.