X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fwidget.cpp;h=bbd2e8877af608b1255d21eb10d9b23d2506fba4;hb=5d219b2f7e8ce196486c225e971f76ceab5538c5;hp=9dbd9da5ba2df7f60f44d824a8a7989d11d917dd;hpb=0e80a70267d6725b4bde456804a5cd80af3c6ec5;p=libs%2Fgltk.git diff --git a/source/widget.cpp b/source/widget.cpp index 9dbd9da..bbd2e88 100644 --- a/source/widget.cpp +++ b/source/widget.cpp @@ -70,10 +70,20 @@ void Widget::set_parent(Container *p) throw hierarchy_error("widget already parented"); else if(p==parent) return; - parent = p; - on_reparent(); - update_style(); + try + { + parent = p; + + on_reparent(); + update_style(); + } + catch(...) + { + // The container has not yet added the widget as its child + parent = 0; + throw; + } } void Widget::set_style(const string &s)