mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 03:57:15 +02:00
PixelPaint: Make PaletteWidget::set_image_editor take a ImageEditor*
After closing the last open ImageEditor, selecting a color would try to dereference it causing a crash. Instead make set_image_editor() take a pointer to it and set it to nullptr when closing the last tab like we do with LayerListWidget and LayerPropertiesWidget.
This commit is contained in:
committed by
Linus Groh
parent
29bbf56286
commit
7ca4d045bd
Notes:
sideshowbarker
2024-07-17 21:18:25 +09:00
Author: https://github.com/metmo Commit: https://github.com/SerenityOS/serenity/commit/7ca4d045bd6 Pull-request: https://github.com/SerenityOS/serenity/pull/11743
@@ -71,6 +71,7 @@ MainWidget::MainWidget()
|
||||
if (m_tab_widget->children().size() == 0) {
|
||||
m_layer_list_widget->set_image(nullptr);
|
||||
m_layer_properties_widget->set_layer(nullptr);
|
||||
m_palette_widget->set_image_editor(nullptr);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -78,7 +79,7 @@ MainWidget::MainWidget()
|
||||
|
||||
m_tab_widget->on_change = [&](auto& widget) {
|
||||
auto& image_editor = verify_cast<PixelPaint::ImageEditor>(widget);
|
||||
m_palette_widget->set_image_editor(image_editor);
|
||||
m_palette_widget->set_image_editor(&image_editor);
|
||||
m_layer_list_widget->set_image(&image_editor.image());
|
||||
m_layer_properties_widget->set_layer(image_editor.active_layer());
|
||||
if (auto* active_tool = m_toolbox->active_tool())
|
||||
|
||||
Reference in New Issue
Block a user