ID:2694614
 
Resolved
The alpha mask filter with the MASK_SWAP flag caused a crash when given a bogus render source.
BYOND Version:514.1557
Operating System:Windows 10 Pro 64-bit
Web Browser:Firefox 89.0
Applies to:Dream Seeker
Status: Resolved (514.1558)

This issue has been resolved.
Descriptive Problem Summary:
I haven't narrowed the bug down yet but you may know what it's from without me having to fully diagnose the issue. On latest beta I have an image with an alpha mask filter using a render source and MASK_SWAP, this image is then applied to another image as an underlay. That other image is then applied to a third image as an overlay, which is then applied as an overlay to an /obj in the world. When the client views this obj it instantly crashes every time, not even a freeze.

I don't know what particular part of that chain is required but if the description doesn't help in figuring out the cause I can narrow it down into a standalone project, I'd just rather not do that if I have to due to the amount of setup required to make a standalone testcase in this scenario.

Numbered Steps to Reproduce Problem:
I'll get proper reproduction if the above isn't good enough.

Code Snippet (if applicable) to Reproduce Problem:
This code was taken straight from the middle of a larger game project, I'll refine it to standalone later.
window = image(icon, icon_state="window-bg", layer=FLOAT_LAYER)

var/list/new_underlays = list()
for(var/obj/effect/overlay/gas/gas as anything in air_contents.return_visuals())
var/image/new_underlay = image(icon, icon_state="window-bg", layer=FLOAT_LAYER)
new_underlay.filters = filter(type="alpha", render_source=gas.render_target, flags=MASK_SWAP)
new_underlays += new_underlay

var/image/foreground = image(icon, icon_state="window-fg", layer=FLOAT_LAYER)
foreground.underlays = new_underlays
window.overlays = list(foreground)

overlays += window


Expected Results:
A gas overlay cut out to fit the background layer in a generated window to a gas storage object.

Actual Results:
Instant client crash on entering view. No server side errors.

Does the problem occur:
Every time? Or how often?
Every time.
In other games?
Will test if further information needed.
In other user accounts?
Yes.
On other computers?
Will test if further information needed.

When does the problem NOT occur?
The same effect can be done without a MASK_SWAP but requires the creation of an icon which I was trying to avoid.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
Does not happen on latest 513

Workarounds:
Switching to a different method that doesn't use MASK_SWAP
I'll definitely need a test project for this.
Any updates narrowing down a test case? I'd really like to get a fix for this in the queue.
Sorry about the delay, it took a bit to isolate what was required for the crash. It turns out some of the world variable changes are required for the crash to occur.

https://www.dropbox.com/s/7zew5h8xgjlw09z/ AlphaMaskCrash.zip?dl=1

You just need to use the verb once loaded in to cause the crash.
Thanks. I'll check it out.
Lummox JR resolved issue with message:
The alpha mask filter with the MASK_SWAP flag caused a crash when given a bogus render source.
It appears the cause of the issue here is that a var wasn't properly being set to null in BYOND's code in a certain case. That case happened when the render_source was not available.

In your code image_object isn't actually displayed anywhere, so it can't be used as a render source and that's why the filter was failing.