Page MenuHomePhabricator

Fix widget threading crashes
Open, LowPublic

Description

These were taken from the 6.7.4 release and 6.8.0 betas. They seem to be related to updating views on threads other than main.

Binary: TopReadWidget
UIKitCore: -[UIImageView _mainQ_beginLoadingIfApplicable] + 72
UIKitCore: -[UIImageView _mainQ_beginLoadingIfApplicable] + 76
CoreAutoLayout: _AssertAutoLayoutOnAllowedThreadsOnly + 416
CoreAutoLayout: _AssertAutoLayoutOnAllowedThreadsOnly + 412

Event Timeline

Just for clarity: the TopReadWidget binary name is identical for both our old-style and new home screen style Top read widgets, but it appears this crash is specifically related to the old-style UIKit Top Read widget (WMFTodayTopReadWidgetViewController).

@Tsevener Was this the function you were mentioning maybe needs some main queue-ifying: https://github.com/wikimedia/wikipedia-ios/blob/33d18b9a146bc109d168234b9d06938c450d34c4/TopReadWidget/WMFTodayTopReadWidgetViewController.swift#L139?

@Dmantena yep that's what I was thinking, although now that I look at it I'm not sure that every call to that method will run on a background thread. If not I think it would be better to work our way up the stack (fetchedCachedWidgetContentGroup seems common among them, for example) confirm where it's calling from a background thread and dispatch the call somewhere up there. This definitely isn't a must for 6.8.1 and if it turns into a rathole we can punt, just seemed like an easy fix at first glance.