the Line,
feature = layer.selectedFeatures()
returns a list of QgsFeature. You will need to loop over it to process individual selections.
If you only have one feature selected in map, thenlike below.
geomlayer = feature[0]qgis.geometryutils.iface.activeLayer()
for feature in layer.selectedFeatures():
mbuf = geomfeature.geometry().buffer(50, 2)
iterFeat = layer.getFeatures()
for f in iterFeat:
geom2 = f.geometry()
might work.