#include <gtkmm.h>

int main (int argc, char *argv[])
{
	// Create the window
	Gtk::Main kit(argc, argv);
	Gtk::Window main_win(Gtk::WINDOW_TOPLEVEL);
	main_win.set_title ("test");
	main_win.set_size_request (200, 50);

	// Create a ScrolledWindow
	// If I use a Gtk::Frame here instead, everything works
	Gtk::ScrolledWindow main_area;

	// Add some button just to show everything works without the buggy code
	Gtk::Button button_test("asdf");
	button_test.set_size_request (200, 100);

	// Add the button to the ScrolledWindow; the ScrolledWindow to the main window
	main_area.add(button_test);
	main_win.add(main_area);

	// Show all widgets on the main window
	main_win.show_all();

	// This should simply remove the button from the ScrolledWindow and re-add it.
	// Without it, everything is fine. But it generates an error, which says 
	// the parent of the button isn't null (this works with other widgets as well)

	// start buggy code
	main_area.remove();
	main_area.add(button_test);
	// end buggy code
	
	kit.run(main_win);
	return 0;
}