From 6f7dc148010ea7a532f05f3068d057e836bce471 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 11 Jul 2020 19:33:35 +0200 Subject: [PATCH] Fix wrong iterator in wxInfoBar::RemoveButton() in wxGTK The iterator passed to erase() was off by 1, but this worked correctly in the default build using wxVector, and not std::vector, because its base() implementation was off by 1 too. Now that wxVector bug is fixed (see the parent) commit, fix the code using it too, which makes it work both in the default and STL builds. Closes #18765. --- src/gtk/infobar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gtk/infobar.cpp b/src/gtk/infobar.cpp index c3d4d4018d..349c4e4ea5 100644 --- a/src/gtk/infobar.cpp +++ b/src/gtk/infobar.cpp @@ -323,7 +323,7 @@ void wxInfoBar::RemoveButton(wxWindowID btnid) if (i->id == btnid) { gtk_widget_destroy(i->button); - buttons.erase(i.base()); + buttons.erase(i.base() - 1); // see comment in GTKAddButton() InvalidateBestSize();