Overlap between life cycle method and push method

I have two methods in my component.
the first one is
// i do some calculation here
it will save some objects.
the second one
goToDetailsPage($event, object)
this.navCtrl.push(DetailsPage, object);

if i press the button to go to details page it works. but if i go back i check that my calculation was corrupted.
so i am asking if i can block or not trigger the ionViewDidLeave method if i am going to details page.
if not what should i do

thank you in advance.

I solve the problem
i use ngOnDestroy instead of ionViewDidLeave