Closed Bug 1780389 Opened 2 years ago Closed 2 years ago

Avoid deadlock in moz_container_wayland_add_initial_draw_callback()

Categories

(Core :: Widget: Gtk, defect, P3)

defect

Tracking

()

RESOLVED FIXED
105 Branch
Tracking Status
firefox105 --- fixed

People

(Reporter: stransky, Assigned: stransky)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

See https://bugzilla.mozilla.org/show_bug.cgi?id=1780190#c1
moz_container_wayland_add_initial_draw_callback() can cause deadlock.

With this patch moz_container_wayland_surface_lock() always locks MozContainer and needs to be paired with moz_container_wayland_surface_unlock() even if it fails and returns nullptr.
Split moz_container_wayland_add_initial_draw_callback() to two new functions:

  • moz_container_wayland_add_initial_draw_callback_locked() is called on locked container and only adds draw callback.
    It asserts when MozContainer is already to draw as we don't expect it.

  • moz_container_wayland_add_or_fire_initial_draw_callback() is called on unlocked container as it has it's own lock.
    It behaves as original moz_container_wayland_add_initial_draw_callback(), i.e. stores draw callback when MosContainer is not visible
    and fires draw callback when we're ready to draw.

Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/d2c2f810bf14
[Wayland] Call moz_container_wayland_add_initial_draw_callback() on locked container, always lock MozContainer for access r=rmader
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
Regressions: 1780679
Backout by bszekely@mozilla.com:
https://hg.mozilla.org/mozilla-central/rev/856755f2ddc6
Backed out changeset d2c2f810bf14 for causing Bug 1780679 a=backout
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: 104 Branch → ---

Backed out for causing causing Bug 1780679

Flags: needinfo?(stransky)
Flags: needinfo?(stransky)
Attachment #9286236 - Attachment description: Bug 1780389 [Wayland] Call moz_container_wayland_add_initial_draw_callback() on locked container, always lock MozContainer for access r?emilio,rmader → Bug 1780389 [Wayland] Implement RAII class MozContainerSurfaceLock to get&lock wl_surface of moz_container r?emilio
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/e4b5b93592b0
[Wayland] Implement RAII class MozContainerSurfaceLock to get&lock wl_surface of moz_container r=rmader

Backed out for causing build bustages on MozContainerWayland.h

Backout link

Push with failures

Failure log

Flags: needinfo?(stransky)

Updated, Thanks.

Flags: needinfo?(stransky)
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/26adc3b79354
[Wayland] Implement RAII class MozContainerSurfaceLock to get&lock wl_surface of moz_container r=rmader
Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch

Failed to land.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

Okay, looks fixed.

Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: