[gtkmm] Fixed bgo #466853 – Gtk::Box_Helpers::BoxList::insert() has wrong return value



commit a905887c456506e82d11257425d918e041617d11
Author: Johannes Schmid <jhs gnome org>
Date:   Tue May 5 12:55:45 2009 +0200

    Fixed bgo #466853 â?? Gtk::Box_Helpers::BoxList::insert() has wrong return value
    
    Also added testcase for the bug
---
 ChangeLog                   |   11 +++++++++++
 configure.ac                |    1 +
 gtk/src/box.ccg             |    4 +++-
 tests/Makefile.am           |    2 +-
 tests/boxhelper/Makefile.am |    6 ++++++
 tests/boxhelper/main.cc     |   29 +++++++++++++++++++++++++++++
 6 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c4355db..edb6351 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-05-05  Johannes Schmid <jschmid openismus com>
+
+	* gtk/gtkmm/box.ccg:
+	* tests/boxhelper/main.c
+	* tests/boxhelper/Makefile.am
+	* tests/Makefile.am
+	* configure.ac:
+	Fixed 466853 â?? Gtk::Box_Helpers::BoxList::insert() has wrong 
+	return value
+	and added testcase
+
 2009-04-28  Johannes Schmid <jschmid openismus com>
 
   * gtk/gtkmm/stock.h:
diff --git a/configure.ac b/configure.ac
index d3770d8..2292aeb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -429,6 +429,7 @@ AC_CONFIG_FILES([
     tests/property_notification/Makefile
     tests/scrolledwindow/Makefile
     tests/wrap_existing/Makefile
+    tests/boxhelper/Makefile
 ])
 
 AC_CONFIG_FILES([
diff --git a/gtk/src/box.ccg b/gtk/src/box.ccg
index aa5d68c..5eda27f 100644
--- a/gtk/src/box.ccg
+++ b/gtk/src/box.ccg
@@ -76,8 +76,10 @@ box_iterator BoxList::insert(box_iterator position, const Element& e)
   i = --end();
 
   if (position!=end())
+	{
     reorder(i, position);
-
+    i = --position;
+  }
   return i;
 }
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 216c80f..8b4b4f8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -2,7 +2,7 @@ test_dirs = child_widget child_widget2 child_widget_managed \
             refcount_dialog dialog dialog_deletethis delete_cpp_child \
             menu_destruction \
             scrolledwindow wrap_existing main_with_options \
-            property_notification
+            property_notification boxhelper
 
 SUBDIRS = $(test_dirs)
 EXTRA_DIST = Makefile.am_fragment
diff --git a/tests/boxhelper/Makefile.am b/tests/boxhelper/Makefile.am
new file mode 100644
index 0000000..519d9ec
--- /dev/null
+++ b/tests/boxhelper/Makefile.am
@@ -0,0 +1,6 @@
+include $(top_srcdir)/tests/Makefile.am_fragment
+
+noinst_PROGRAMS = test
+test_SOURCES = main.cc
+
+
diff --git a/tests/boxhelper/main.cc b/tests/boxhelper/main.cc
new file mode 100644
index 0000000..5d276cb
--- /dev/null
+++ b/tests/boxhelper/main.cc
@@ -0,0 +1,29 @@
+#include <gtkmm.h>
+#include <iostream>
+
+int main (int argc, char** argv)
+{
+  Gtk::Main main(argc, argv);
+  Gtk::HBox* box = new Gtk::HBox();
+  Gtk::Label* label1 = new Gtk::Label("1");
+  Gtk::Label* label2 = new Gtk::Label("2");
+  Gtk::Label* label3 = new Gtk::Label("3");
+  Gtk::Window* window = new Gtk::Window();
+  
+  window->set_title("Box Test");
+  window->add(*box);
+  
+  Gtk::Box_Helpers::BoxList list = box->children();
+  list.push_back (Gtk::Box_Helpers::Element(*label1));
+  list.push_back (*label3);
+  Gtk::Box_Helpers::BoxList::iterator inserted = list.insert (++list.begin(), *label2);
+  
+  if ((label2 = dynamic_cast<Gtk::Label*>(inserted->get_widget())))
+    std::cout << "inserted label: " << label2->get_label() << std::endl;
+
+  window->show_all();  
+  main.run(*window);
+
+  
+  return 0;
+}
\ No newline at end of file



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]