Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileManager+LibGUI: Fix crash when opening a folder, as well as when … #569

Merged
merged 1 commit into from Sep 17, 2019

Conversation

@xeons
Copy link
Contributor

commented Sep 16, 2019

  • Fixed a crash that occurs when trying to open a folder, or when trying to open a newly created folder.
  • Treeview now refreshes after creating the new folder.

This fixes #536.

Copy link
Member

left a comment

Thanks for working on this! :)

@@ -31,6 +31,15 @@ struct GFileSystemModel::Node {
ASSERT_NOT_REACHED();
}

void cleanup()
{
for(auto &child: children) {

This comment has been minimized.

Copy link
@awesomekling

awesomekling Sep 16, 2019

Member

Please use the same formatting as the rest of the codebase:

Suggested change
for(auto &child: children) {
for (auto& child : children) {

You can use clang-format (version 8 or later) to do this automatically. I have it set up so I just press a key combination in my editor to invoke it, for example :)

This comment has been minimized.

Copy link
@xeons

xeons Sep 16, 2019

Author Contributor

I'll see if I can get this, looks like linux mint only has version 6.


auto current_path = directory_view->path();

// not exactly sure why i have to reselect the root node first, but the index() fails if I dont

This comment has been minimized.

Copy link
@awesomekling

awesomekling Sep 16, 2019

Member

This is very suspicious but okay for now :)

// not exactly sure why i have to reselect the root node first, but the index() fails if I dont
auto root_index = file_system_model->index(file_system_model->root_path());
tree_view->selection().set(root_index);
tree_view->scroll_into_view(root_index, Orientation::Vertical);

This comment has been minimized.

Copy link
@awesomekling

awesomekling Sep 16, 2019

Member

Do we really need to scroll_into_view and update twice for the workaround as well?

This comment has been minimized.

Copy link
@xeons

xeons Sep 16, 2019

Author Contributor

I'll play around with this tonight to see if everything is required or not.

This comment has been minimized.

Copy link
@xeons

xeons Sep 16, 2019

Author Contributor

Looks as though just setting the index was required.

@xeons xeons force-pushed the xeons:patch-folders-filemanager branch from d74a55a to aac31c1 Sep 16, 2019
@awesomekling awesomekling merged commit a4d52b1 into SerenityOS:master Sep 17, 2019
@xeons xeons deleted the xeons:patch-folders-filemanager branch Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.