Skip to content

SSAOPass.dispose() broken #18148

@drcmda

Description

@drcmda
Description of the problem

We noticed this first here: https://codesandbox.io/s/react-three-fiber-blob-qv9ww?from-embed

Go anywhere in the code and make a new line by hitting enter, it compiles then crashes (in the browser console). This happens because components unmount and dispose is called on the effect.

Plain JS example:

import * as THREE from 'three'
import { SSAOPass } from 'three/examples/jsm/postprocessing/SSAOPass'

const s = new THREE.Scene()
const c = new THREE.Camera()
const q = new SSAOPass(s,c)
q.dispose() // crash

SSAOPass tries to dispose some quad, but that quad is neither part of SSAOPass, nor Pass, looks to me like a leftover.

this.quad.geometry.dispose(); // dispose materials
SSAOPass.js:138 Uncaught TypeError: Cannot read property 'geometry' of undefined
    at SSAOPass.dispose (SSAOPass.js:138)

I thought about making a PR but wasn't sure, maybe this quad does belong in there and comes from somewhere else?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions