I have implemented a webpart with custom properties in an editor part. If I click apply or ok, the values are successfully updated (code in OnPreRender). The problem is now that if I click apply and then cancel, the changed values are saved and not discarded. I could not find a reason for that. Does anybody know a solution?
This is by design and not an error.
Last data saved was (A) and thats what you've got - it cancelled any updates directly (B) before cancel.
Sure you could change this in your toolpart with some complex scheme but then your toolpart will work differently than everything else in SharePoint so is likely to be even more confusing.
Is this a real problem for you?
Yea, i don't think onprerender is the right event to do this. It should be the applychanges override in the editorpart.