Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

RBLHTMLView spinning the run loop #110

Open

Description

@alanjrogers

https://github.com/github/Rebel/blob/master/Rebel/RBLHTMLView.m#L118-L120

RBLHTMLView spins the current run loop while it waits for the HTML to render.

I haven't dug into it too far yet, but I've seen this cause an intermittent crash if the HTML for the view has been assigned inside of a 'transaction' such as the begin/endUpdates calls used in view based NSTableViews.

For example:

- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
    if ((NSUInteger)row >= self.cellCount) return nil;

    if (row == 0) {
       MYCellView *cellView = [[MYCellView alloc] initWithNibName:@"MYCellView" bundle:nil];
         cellView.rblHTMLView = self.htmlString;
    }
}

This method is called when rows are inserted into the table view, so usually after a call to [tableView beginUpdates]. My theory is that spinning the run loop is implicitly calling endUpdates resulting in unbalanced calls.

Activity

  1. jspahrsummers commented on Sep 6, 2013

    @jspahrsummers
    Contributor

    I think this is done to avoid a flash when the page reloads (by simply not returning control to the renderer until the page is ready).

    Maybe we could instead do this in a block asynchronously dispatched to the main thread. It'd introduce an imperceptible delay before starting to render, but would ensure that it occurs outside of any transactional behavior.

  2. joshaber commented on Sep 15, 2013

    @joshaber
    Contributor

    This was to ensure that it rendered the new content as soon as it was set, as you'd expect a label to do. Introducing a queue hop doesn't seem like it'd solve the problem :\

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions