GNOME Bugzilla – Bug 539092
Remove unnecessary null pointer checks
Last modified: 2010-10-29 16:29:28 UTC
The null pointer checks for the pointers "p_filesystem", "frame_resizer_base", "cursor_resize" and "cursor_move" are not needed in the corresponding destructors. http://dietmar-kuehl.de/mirror/c++-faq/freestore-mgmt.html#faq-16.8 I suggest to adjust their implementations. http://svn.gnome.org/viewvc/gparted/trunk/src/GParted_Core.cc?revision=857&view=markup http://svn.gnome.org/viewvc/gparted/trunk/src/Frame_Resizer_Base.cc?revision=696&view=markup http://svn.gnome.org/viewvc/gparted/trunk/src/Dialog_Base_Partition.cc?revision=856&view=markup
Created attachment 113025 [details] [review] little clean-up for destructors
Created attachment 113028 [details] [review] tiny clean-up for a member function
Created attachment 113030 [details] [review] little clean-up for destructors
Created attachment 164518 [details] [review] update suggestion Would you like to integrate the appended changes into your source code repository?
Thank you Markus for your persistence with this bug report, and for updating the patch for the git repository. I have done lots of programming in the C language and hence am aware of the problems that occur when dereferencing NULL pointers. The link you provided was very useful to confirm that this is not a problem when deleting pointers in C++. It is useful to de-clutter source code whenever one can. It helps with the code readability. Not many people would have noticed this so thank you for pointing it out. :-) I have committed your patch to the gnome git repository for inclusion in the next release of GParted (0.7.0). The relevant commit can be viewed at the following link: http://git.gnome.org/browse/gparted/commit/?id=1e2562adda8d315c36a709ce9b8086f3e2e97933 Please feel free to close this bug report, or if you find more situations then a patch would be great. Sincerely, Curtis Gedak PS: I will continue to review and comment on the other bug reports you have posted. I am juggling many competing priorities, so your patience is appreciated.
Thanks go to Markus for providing a patch to simplify the GParted source code. The enhancements to address this bug report have been included in GParted 0.7.0 which was released on October 29, 2010. Closing this bug report.