I am trying to get the geodetic location of a point where the user clicks the left mouse button. The code below is initiated by calling CaptureCursorLocation. That sets up a callback that waits for the user to click the left button anywhere on the map. After they click the button SetCursorLocation is called to pass the location up to the parent. For the most part that works except that I cannot stop the callback. When I call removeEventHandler(mCursorLocationhandler); the application crashes as soon as it returns from frame(). The error message in Visual Studio is the familier "Expression List iterator is not incrementable. The stack trace only shows that it was in osg157-osgViewerd. If I don't call the removeEventHandler there is no crash but it keeps going through the callback as would be expected.
Is there some other way to get a user selected location to dynamically place things on the map?
the OsgEarthWindow header includes the following line