diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2010-01-07 16:02:44 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2010-01-07 16:02:44 +0000 |
| commit | bb344898261ae0f6b90e6e519a266885d1d7c027 (patch) | |
| tree | 719e1d121adc080800949dae7a4cd664864128b3 | |
| parent | e5fed1d0facb20e72e91732a2cf9289cd1146f6f (diff) | |
Fixed stupid crash bug in Fl_Preferences.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6990 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | FL/Fl_Preferences.H | 4 | ||||
| -rw-r--r-- | src/Fl_Preferences.cxx | 15 |
2 files changed, 11 insertions, 8 deletions
diff --git a/FL/Fl_Preferences.H b/FL/Fl_Preferences.H index b5dffe14c..e16ff64d3 100644 --- a/FL/Fl_Preferences.H +++ b/FL/Fl_Preferences.H @@ -201,8 +201,8 @@ private: RootNode *root_; // top_ bit set }; char *path_; - char dirty_:1; - char top_:1; + unsigned char dirty_:1; + unsigned char top_:1; public: Node( const char *path ); ~Node(); diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx index b1694a7fa..120bd99de 100644 --- a/src/Fl_Preferences.cxx +++ b/src/Fl_Preferences.cxx @@ -229,6 +229,9 @@ Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, const char *group ) If the given index is invalid (negative or too high), a new group is created with a UUID as a name. + The index needs to be fixed. It is currently backward. Index 0 points + to the last member in the 'list' of preferences. + \param[in] parent reference object for the new group \param[in] groupIndex zero based index into child groups */ @@ -1297,7 +1300,7 @@ Fl_Preferences::RootNode *Fl_Preferences::Node::findRoot() do { if (n->top_) return n->root_; - n = n->parent_; + n = n->parent(); } while (n); return 0L; @@ -1465,7 +1468,7 @@ Fl_Preferences::Node *Fl_Preferences::Node::search( const char *path, int offset else if ( path[1] == '/' ) { Node *nn = this; - while ( nn->parent_ ) nn = nn->parent_; + while ( nn->parent() ) nn = nn->parent(); if ( path[2]==0 ) { // user is searching for root ( "./" ) return nn; @@ -1543,9 +1546,9 @@ Fl_Preferences::Node *Fl_Preferences::Node::childNode( int ix ) char Fl_Preferences::Node::remove() { Node *nd = 0, *np; - if ( parent_ ) + if ( parent() ) { - nd = parent_->child_; np = 0L; + nd = parent()->child_; np = 0L; for ( ; nd; np = nd, nd = nd->next_ ) { if ( nd == this ) @@ -1553,11 +1556,11 @@ char Fl_Preferences::Node::remove() if ( np ) np->next_ = nd->next_; else - parent_->child_ = nd->next_; + parent()->child_ = nd->next_; break; } } - parent_->dirty_ = 1; + parent()->dirty_ = 1; } delete this; return ( nd != 0 ); |
