Commit ebef5405 authored by Daniel Elstner's avatar Daniel Elstner
Browse files

:find_add_file): Create the FileInfo object in advance before inserting

* src/filetree.cc (FileTree::find_add_file): Create the FileInfo
object in advance before inserting the new row in order to improve
exception safety.
(FileTree::find_fill_dirstack): Same here for the DirInfo object.
parent 046e063b
2004-06-09 Daniel Elstner <daniel.elstner@gmx.net>
* src/filetree.cc (FileTree::find_add_file): Create the FileInfo
object in advance before inserting the new row in order to improve
exception safety.
(FileTree::find_fill_dirstack): Same here for the DirInfo object.
2004-06-09 Daniel Elstner <daniel.elstner@gmx.net>
* src/filetreeprivate.{cc,h} (FileTreePrivate::next_match_file):
......
......@@ -438,6 +438,8 @@ void FileTree::find_add_file(const Glib::ustring& basename, const std::string& f
std::string collate_key (1, '1');
collate_key += basename.collate_key();
const FileInfoBasePtr fileinfo (new FileInfo(fullname));
Gtk::TreeModel::Row row;
if (find_data.dirstack.empty())
......@@ -456,7 +458,7 @@ void FileTree::find_add_file(const Glib::ustring& basename, const std::string& f
row[columns.filename] = basename;
row[columns.collatekey] = collate_key;
row[columns.fileinfo] = FileInfoBasePtr(new FileInfo(fullname));
row[columns.fileinfo] = fileinfo;
}
void FileTree::find_fill_dirstack(FindData& find_data)
......@@ -479,6 +481,8 @@ void FileTree::find_fill_dirstack(FindData& find_data)
std::string collate_key (1, '0');
collate_key += dirname.collate_key();
const FileInfoBasePtr dirinfo (new DirInfo());
if (pprev == pend)
pdir->second = treestore_->prepend(); // new toplevel node
else
......@@ -488,7 +492,7 @@ void FileTree::find_fill_dirstack(FindData& find_data)
row[columns.filename] = dirname;
row[columns.collatekey] = collate_key;
row[columns.fileinfo] = FileInfoBasePtr(new DirInfo());
row[columns.fileinfo] = dirinfo;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment