diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index c3c0daed0f4017cd770331d638e655c5246faad1..8ab015f2bb85c5e5db6a69fde8eb5a25025f0087 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -449,3 +449,9 @@ const std::string* LLUICtrlFactory::getWidgetTag(const std::type_info* widget_ty
 {
 	return LLWidgetNameRegistry::instance().getValue(widget_type);
 }
+
+// static
+void LLUICtrlFactory::connect(LLView* parent, LLView* child)
+{
+	parent->addChild(child);
+}
\ No newline at end of file
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 0ccd3047f6c84d56fdcb3993a2d7927fbde4f90f..8a9c9e23c1d76a43d00a764894417b84d395d477 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -188,10 +188,15 @@ class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory>
 		T* widget = new T(params);
 		widget->initFromParams(params);
 		if (parent)
-			parent->addChild(widget);
+		{
+			connect(parent, widget);
+		}
 		return widget;
 	}
 
+	// fix for gcc template instantiation annoyance
+	static void connect(LLView* parent, LLView* child);
+	
 	LLView* createFromXML(LLXMLNodePtr node, LLView* parent, const std::string& filename, const widget_registry_t&, LLXMLNodePtr output_node );
 
 	template<typename T>