Skip to content

Removing a symbol layer and immediately readding it as a circle layer causes TypeError in draw_circle #3633

Closed

Description

@anandthakker

mapbox-gl-js version: 0.27

Steps to Trigger Behavior

  1. Create a map with a symbol layer with id 'a'
  2. map.removeLayer('a'); map.addLayer({ id: 'a', type: 'circle', source: (same as the symbol layer) })

Expected Behavior

There are no errors

Actual Behavior

TypeError: Cannot read property 'circle' of undefined
    at Object.drawCircles [as circle] (/Users/anand/c/mapbox/mapbox-gl-js/js/render/draw_circle.js:27:44)
    at Painter.renderLayer (/Users/anand/c/mapbox/mapbox-gl-js/js/render/painter.js:271:25)
    at Painter.renderPass (/Users/anand/c/mapbox/mapbox-gl-js/js/render/painter.js:254:18)
    at Painter.render (/Users/anand/c/mapbox/mapbox-gl-js/js/render/painter.js:213:14)
    at Map._render (/Users/anand/c/mapbox/mapbox-gl-js/js/ui/map.js:1141:22)
    at Immediate.immediate._onImmediate (timers.js:585:18)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)

I think the problem is that, since this is happening in a single batch, the it's being treated by the source cache as an update--specifically, the tiles' states are set to reloading, so that they are still considered renderable. In the render pass that happens after the layer's been re-added but before the tile reloading is complete, we end up trying to render them as a circle-layer tiles, but the buffers aren't set up for that yet.

Activity

  1. anandthakker commented on Nov 16, 2016

    @anandthakker
    ContributorAuthor

    @jfirebaugh found this while adding a runtime-styling test for setStyle (changing a layer's type) -- do you think this should block #3621, or be left as a follow-up? (In the latter case, I could add an ignore for js pointing to this issue.)

  2. jfirebaugh commented on Nov 16, 2016

    @jfirebaugh
    Contributor

    This sort of situation will be more common with #3621, so let's fix it first.

  3. anandthakker commented on Nov 16, 2016

    @anandthakker
    ContributorAuthor

    👍 sounds good.

    On Wed, Nov 16, 2016 at 2:18 PM John Firebaugh [email protected]
    wrote:

    This sort of situation will be more common with #3621
    #3621, so let's fix it first.

    —
    You are receiving this because you authored the thread.
    Reply to this email directly, view it on GitHub
    #3633 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe-auth/AEvmR3hvDieUDhivyyoHasCa3LmkPW01ks5q-4E0gaJpZM4K0Z-w
    .

  4. added 3 commits that reference this issue on Nov 17, 2016
    a540347
    082a962
    1c1ab85
  5. added a commit that references this issue on Nov 21, 2016
    fc49a2c
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