|
|
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: https://www.fltk.org/str.php?L3235
Version: 1.3-current
Attached file "Fl_Pref_patch.txt"...
Link: https://www.fltk.org/str.php?L3235
Version: 1.3-current diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx
index 48e77bc..f7d8b0d 100644
--- a/src/Fl_Preferences.cxx
+++ b/src/Fl_Preferences.cxx
@@ -270,7 +270,10 @@ char Fl_Preferences::groupExists( const char *key ) {
*/
char Fl_Preferences::deleteGroup( const char *group ) {
Node *nd = node->search( group );
- if ( nd ) return nd->remove();
+ if ( nd ) {
+ char c = nd->remove(); delete nd;
+ return c;
+ }
return 0;
}
@@ -1001,11 +1004,8 @@ Fl_Preferences::Node::Node( const char *path ) {
}
void Fl_Preferences::Node::deleteAllChildren() {
- Node *nx;
- for ( Node *nd = child_; nd; nd = nx ) {
- nx = nd->next_;
- delete nd;
- }
+ // This will traverse the rest of the linked list.
+ if (child_ != 0L) delete child_;
child_ = 0L;
dirty_ = 1;
updateIndex();
@@ -1033,15 +1033,16 @@ void Fl_Preferences::Node::deleteAllEntries() {
// delete this and all depending nodes
Fl_Preferences::Node::~Node() {
- deleteAllChildren();
- deleteAllEntries();
- deleteIndex();
if ( path_ ) {
free( path_ );
path_ = 0L;
}
- next_ = 0L;
- parent_ = 0L;
+ if (next_ != 0L) {
+ delete next_;
+ next_ = 0L;
+ }
+ deleteAllEntries();
+ deleteIndex();
}
// recursively check if any entry is dirty (was changed after loading a fresh prefs file)
@@ -1345,7 +1346,6 @@ char Fl_Preferences::Node::remove() {
parent()->dirty_ = 1;
parent()->updateIndex();
}
- delete this;
return ( nd != 0 );
}
[ Direct Link to Message ] | |
|
| |