← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1841471-close-dropdowns-with-parent-windows into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1841471-close-dropdowns-with-parent-windows into lp:widelands.

Commit message:
Fix deleting of dropdown lists in UniqueWindow and Player Menu.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1841471 in widelands: "Open dropdowns don´t close when closing parent window"
  https://bugs.launchpad.net/widelands/+bug/1841471

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1841471-close-dropdowns-with-parent-windows/+merge/371999
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1841471-close-dropdowns-with-parent-windows into lp:widelands.
=== modified file 'src/editor/ui_menus/player_menu.h'
--- src/editor/ui_menus/player_menu.h	2019-08-10 16:38:15 +0000
+++ src/editor/ui_menus/player_menu.h	2019-08-29 12:39:07 +0000
@@ -38,8 +38,6 @@
 	EditorPlayerMenu(EditorInteractive&,
 	                 EditorSetStartingPosTool& tool,
 	                 UI::UniqueWindow::Registry&);
-	~EditorPlayerMenu() override {
-	}
 
 private:
 	// Container with UI elements to set a player slot's properties

=== modified file 'src/ui_basic/dropdown.cc'
--- src/ui_basic/dropdown.cc	2019-07-28 11:33:50 +0000
+++ src/ui_basic/dropdown.cc	2019-08-29 12:39:07 +0000
@@ -147,9 +147,8 @@
 
 BaseDropdown::~BaseDropdown() {
 	// The list needs to be able to drop outside of windows, so it won't close with the window.
-	// Deleting here leads to a conflict as to who gets to delete it, so we just leave it.
-	// It will be hidden as soon as the mouse moves away anyway.
-	// TODO(GunChleoc): Investigate whether we can find a better solution for this
+	// So, we tell it to die.
+	list_->die();
 }
 
 void BaseDropdown::set_height(int height) {

=== modified file 'src/ui_basic/unique_window.cc'
--- src/ui_basic/unique_window.cc	2019-06-01 14:16:25 +0000
+++ src/ui_basic/unique_window.cc	2019-08-29 12:39:07 +0000
@@ -63,7 +63,8 @@
 			window->restore();
 			opened();
 		} else {
-			window->die();
+			// Delete rather than die() to make dropdown lists behave
+			delete window;
 		}
 	} else {
 		open_window();


Follow ups