HasSelectedShape() is false, but SelectedShape() returns a valid shape

I'm trying to select a solid using myContext->ActivateStandardMode(TopAbs_SOLID).

myContext->HasSelectedShape() returns false, but if I ignore that and do
TopoDS_Shape S = myContext->SelectedShape();
S is the shape I wanted to get.

What am I doing wrong?

Mark's picture

oops, need to reword that.
"S is the shape I wanted to get." -> "S now contains the shape that was selected."