fix crash when dragging selected element

This commit is contained in:
Mark 2023-11-12 21:08:46 +01:00
parent 4dcd2967a5
commit d163d4c8c4
2 changed files with 4 additions and 31 deletions

View File

@ -936,16 +936,7 @@ impl GuiElem for ListArtist {
let selected = self.selected.clone(); let selected = self.selected.clone();
info.actions.push(GuiAction::Do(Box::new(move |gui| { info.actions.push(GuiAction::Do(Box::new(move |gui| {
let q = selected.as_queue( let q = selected.as_queue(
gui.gui &gui.gui.c_main_view.children.2,
.children()
.nth(3)
.unwrap()
.children()
.nth(2)
.unwrap()
.any()
.downcast_ref()
.unwrap(),
&gui.database.lock().unwrap(), &gui.database.lock().unwrap(),
); );
gui.exec_gui_action(GuiAction::SetDragging(Some(( gui.exec_gui_action(GuiAction::SetDragging(Some((
@ -1083,16 +1074,7 @@ impl GuiElem for ListAlbum {
let selected = self.selected.clone(); let selected = self.selected.clone();
info.actions.push(GuiAction::Do(Box::new(move |gui| { info.actions.push(GuiAction::Do(Box::new(move |gui| {
let q = selected.as_queue( let q = selected.as_queue(
gui.gui &gui.gui.c_main_view.children.2,
.children()
.nth(3)
.unwrap()
.children()
.nth(2)
.unwrap()
.any()
.downcast_ref()
.unwrap(),
&gui.database.lock().unwrap(), &gui.database.lock().unwrap(),
); );
gui.exec_gui_action(GuiAction::SetDragging(Some(( gui.exec_gui_action(GuiAction::SetDragging(Some((
@ -1226,16 +1208,7 @@ impl GuiElem for ListSong {
let selected = self.selected.clone(); let selected = self.selected.clone();
info.actions.push(GuiAction::Do(Box::new(move |gui| { info.actions.push(GuiAction::Do(Box::new(move |gui| {
let q = selected.as_queue( let q = selected.as_queue(
gui.gui &gui.gui.c_main_view.children.2,
.children()
.nth(3)
.unwrap()
.children()
.nth(2)
.unwrap()
.any()
.downcast_ref()
.unwrap(),
&gui.database.lock().unwrap(), &gui.database.lock().unwrap(),
); );
gui.exec_gui_action(GuiAction::SetDragging(Some(( gui.exec_gui_action(GuiAction::SetDragging(Some((

View File

@ -41,7 +41,7 @@ pub struct GuiScreen {
c_idle_display: IdleDisplay, c_idle_display: IdleDisplay,
c_status_bar: StatusBar, c_status_bar: StatusBar,
c_settings: Settings, c_settings: Settings,
c_main_view: Panel<( pub c_main_view: Panel<(
Button<[Label; 1]>, Button<[Label; 1]>,
Button<[Label; 1]>, Button<[Label; 1]>,
LibraryBrowser, LibraryBrowser,