Skip to content

fix(nullRef): nullify reference to the destroyed slider#5377

Merged
adamdbradley merged 1 commit intoionic-team:masterfrom
VinceOPS:VinceOPS-patch-4
Feb 10, 2016
Merged

fix(nullRef): nullify reference to the destroyed slider#5377
adamdbradley merged 1 commit intoionic-team:masterfrom
VinceOPS:VinceOPS-patch-4

Conversation

@VinceOPS
Copy link
Copy Markdown

@VinceOPS VinceOPS commented Feb 9, 2016

Hi ionic team.

I've got an issue today with ionSlides, using it in a ui-view. When leaving the view containing the slider, by loading another one into the ui-view, the update method of ionSlides was triggered and executed _this.__slider.update() in spite of the "falsy-check" just before. Indeed, the instance of the slider is kept even after the slider is destroyed (because of $scope $destroy event).

A simple PR to nullify the reference after the slider is destroyed.

In order for this piece of code to work properly:

  this.update = function() {
    $timeout(function() {
      if (!_this.__slider) {
        return;
      }

      // not called if the reference is properly nullified
      _this.__slider.update();
      [...]

adamdbradley added a commit that referenced this pull request Feb 10, 2016
fix(nullRef): nullify reference to the destroyed slider
@adamdbradley adamdbradley merged commit d5ecd3f into ionic-team:master Feb 10, 2016
@adamdbradley
Copy link
Copy Markdown
Contributor

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants