Skip to content

Commit

Permalink
Fix infinite loop bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
sammykim committed Sep 6, 2013
1 parent 7ea10ff commit 7a1493a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/gfx/text/glyph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ impl<'self> Iterator<(uint, GlyphInfo<'self>)> for GlyphIterator<'self> {
// Would use 'match' here but it borrows contents in a way that
// interferes with mutation.
if self.glyph_range.is_some() {
match self.glyph_range.unwrap().next() {
match self.glyph_range.get_mut_ref().next() {
Some(j) => Some((self.char_index,
DetailGlyphInfo(self.store, self.char_index, j as u16))),
None => {
Expand Down

3 comments on commit 7a1493a

@metajack
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there an infinite loop here? It's hard to tell from this diff why this change would make any difference.

@sanxiyn
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.glyph_range is an Option. The intent of the code is to modify it, but when you unwrap, you get a copy, and next is modifying a copy, not self.glyph_range. Hence infinite loop.

@metajack
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Please sign in to comment.