[gtkmm/gtkmm-3-22] gtk-demo: Don’t remove_page() with invalid index
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/gtkmm-3-22] gtk-demo: Don’t remove_page() with invalid index
- Date: Fri, 26 May 2017 16:30:58 +0000 (UTC)
commit 6025de7f5f20c0767402ea80beae1a600e1578dd
Author: Daniel Boles <dboles src gnome org>
Date: Fri May 26 16:03:36 2017 +0100
gtk-demo: Don’t remove_page() with invalid index
The decrement was in the iteration expression, so it happened after the
loop body. So on the first iteration, this would call remove_page() with
i == get_n_pages(), which is of course 1 past the maximal allowed index.
demos/gtk-demo/demowindow.cc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/demos/gtk-demo/demowindow.cc b/demos/gtk-demo/demowindow.cc
index 26e7e23..0be66f2 100644
--- a/demos/gtk-demo/demowindow.cc
+++ b/demos/gtk-demo/demowindow.cc
@@ -434,7 +434,7 @@ void DemoWindow::add_data_tabs(const std::string& filename)
void DemoWindow::remove_data_tabs()
{
// Remove all tabs except Info and Source.
- for (int i = m_Notebook.get_n_pages(); i > 1; --i)
+ for (int i = m_Notebook.get_n_pages(); i-- > 2;)
{
m_Notebook.remove_page(i);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]