diff options
author | Andreas Kling <kling@serenityos.org> | 2021-07-29 11:27:13 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-29 11:44:39 +0200 |
commit | f6ccff944af879ed94b6854744440dc7a0d4c37a (patch) | |
tree | 6e925166b342980863858db697b8661a6fca2928 /Userland | |
parent | ebb96b7fead08b64b8a771b9f0a3ff51820b7aaf (diff) | |
download | serenity-f6ccff944af879ed94b6854744440dc7a0d4c37a.zip |
Profiler: Don't perform disassembly when disassembly view is hidden
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/DevTools/Profiler/main.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp index 90d229b7bf..ad835f4067 100644 --- a/Userland/DevTools/Profiler/main.cpp +++ b/Userland/DevTools/Profiler/main.cpp @@ -143,14 +143,22 @@ int main(int argc, char** argv) auto& disassembly_view = bottom_splitter.add<GUI::TableView>(); disassembly_view.set_visible(false); + auto update_disassembly_model = [&] { + if (disassembly_view.is_visible() && !tree_view.selection().is_empty()) { + profile->set_disassembly_index(tree_view.selection().first()); + disassembly_view.set_model(profile->disassembly_model()); + } else { + disassembly_view.set_model(nullptr); + } + }; + tree_view.on_selection_change = [&] { - const auto& index = tree_view.selection().first(); - profile->set_disassembly_index(index); - disassembly_view.set_model(profile->disassembly_model()); + update_disassembly_model(); }; auto disassembly_action = GUI::Action::create_checkable("Show &Disassembly", { Mod_Ctrl, Key_D }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/x86.png"), [&](auto& action) { disassembly_view.set_visible(action.is_checked()); + update_disassembly_model(); }); auto& samples_tab = tab_widget.add_tab<GUI::Widget>("Samples"); |