Releasing feature class lock after editing

Discussion created by rkelso on Jan 30, 2013
Latest reply on Jan 31, 2013 by scjpike
Basically, I've got an ArcMap project (ArcGIS version 10.0) with some custom buttons in it.  One of the buttons uses ArcObjects to change the data source of several layers from a feature class in one File geodatabase to a similar feature class in a different File geodatabase.  I've got it working so that this process releases any locks on the original feature class that was in the map (using FinalReleaseComObject).  After the data source gets switched, the button also uses ArcObjects to delete the original feature class.  All of this functionality works perfectly if no edits have been made to the data.  The button is not enabled if you are editing.

The problem I'm having is, if the user does make some edits to the data and saves the edits, then the locks on this feature class will not be released until the ArcMap application is closed, even after my button has changed the layer's data source.  I can manually remove the layers from the map, I can load a new or different map document from the File menu, but none of these things releases the lock on this feature class.  Like I said, if the user has not made or saved any edits, this all works properly.

Any ideas on how I can get the lock to go away without closing the application window?