Disabling a source can lead to a crash
@debarshir
Submitted by Debarshi Ray Link to original bug (#756489)
Description
When a source is disabled, we don't cancel all the pending operations associated with it - creating PhotosBaseItem instances, creating thumbnails, etc.. Those operations continue with the assumption that there is a corresponding PhotosSource in PhotosSourceManager, which isn't true because we disabled the source, and this leads to a crash.
The backtrack can look like this:
#0 photos_source_get_name (self=0x0) at photos-source.c:282
No locals.
#1 0x000000000045ea6c in photos_utils_get_provider_name (src_mngr=<optimized out>, item=<optimized out>) at photos-utils.c:651
source = <optimized out>
resource_urn = <optimized out>
#2 0x0000000000444763 in photos_google_item_constructed (object=<optimized out>) at photos-google-item.c:266
self = 0x1fd2cf0
name = <optimized out>
#3 0x00007faebac434f4 in g_object_new_internal (class=class@entry=0xe84cf0, params=params@entry=0x7fff3ed55800, n_params=n_params@entry=2) at gobject.c:1814
nqueue = 0x11a4c30
object = 0x1fd2cf0
__FUNCTION__ = "g_object_new_internal"
#4 0x00007faebac45195 in g_object_new_valist (object_type=object_type@entry=14146608, first_property_name=first_property_name@entry=0x47e4ef "cursor", var_args=var_args@entry=0x7fff3ed55950) at gobject.c:2034
stack_params = {{pspec = 0xfe8090, value = 0x7fff3ed55750}, {pspec = 0xfe8020, value = 0x7fff3ed55720}, {pspec = 0xded7a4, value = 0x1000}, {pspec = 0x0, value = 0x0}, {pspec = 0x7fff3ed55820, value = 0x1}, {pspec = 0x7fff3ed55870, value = 0x50}, {pspec = 0x0, value = 0x7faeba92dd48 <g_hash_table_lookup+40>}, {pspec = 0x1, value = 0x52}, {pspec = 0xdfe020, value = 0x7fff3ed558d8}, {pspec = 0xdf80a0, value = 0xdf80a0}, {pspec = 0xdf80a0, value = 0x0}, {pspec = 0xde2400, value = 0x7fff3ed55a00}, {pspec = 0x0, value = 0x73a236bf06283900}, {pspec = 0x75, value = 0xded730}, {pspec = 0x0, value = 0x0}, {pspec = 0x28, value = 0xdf80a0}}
params = 0x7fff3ed55800
name = <optimized out>
n_params = 2
class = <optimized out>
unref_class = <optimized out>
object = <optimized out>
__FUNCTION__ = "g_object_new_valist"
#5 0x00007faebac454d1 in g_object_new (object_type=object_type@entry=14146608, first_property_name=first_property_name@entry=0x47e4ef "cursor") at gobject.c:1617
var_args = {{gp_offset = 48, fp_offset = 48, overflow_arg_area = 0x7fff3ed55a40, reg_save_area = 0x7fff3ed55970}}
__FUNCTION__ = "g_object_new"
#6 0x0000000000445c04 in photos_item_manager_create_item (self=self@entry=0xfeb050, cursor=cursor@entry=0x7fae740048b0) at photos-item-manager.c:344
ret_val = 0x0
extension = <optimized out>
type = 14146608
extension_name = <optimized out>
identifier = 0x2027e30 "google:picasaweb:https://picasaweb.google.com/data/entry/user/111904048869002506544/albumid/6086768662926517297/photoid/6015572207277350130"
split_identifier = 0x1f0ac70
#7 0x0000000000445ceb in photos_item_manager_add_item (self=0xfeb050, cursor=0x7fae740048b0) at photos-item-manager.c:296
item = 0x0
object = <optimized out>
id = 0x1018188 "urn:uuid:d039b32e-5189-4f67-8339-b88848f303e6"
#8 0x0000000000445d9f in photos_item_manager_item_created_executed (cursor=0x7fae740048b0, user_data=<optimized out>) at photos-item-manager.c:61
self = 0xfeb050
#9 0x000000000045a052 in photos_single_item_job_emit_callback (self=0x7fae880056b0) at photos-single-item-job.c:63
priv = <optimized out>
#10 photos_single_item_job_cursor_next (source_object=<optimized out>, res=0x7faea4003440, user_data=<optimized out>) at photos-single-item-job.c:90
self = 0x7fae880056b0
priv = 0x7fae88005680
cursor = 0x7fae740048b0
error = 0x0
valid = <optimized out>
Or like this:
#0 0x000000000046dd86 in photos_source_get_goa_object (self=0x0) at photos-source.c:289
No locals.
#1 0x000000000044e77d in photos_google_get_picasaweb_file (item=0xbd8840, cancellable=0x0, error=0x7fffc19a0b88)
at photos-google-item.c:100
priv = 0xbd8710
source = 0x0
authorization_domain = 0x7ffff165e016 <g_type_free_instance+342>
entry = 0xd80c80
authorizer = 0xd80f50
query = 0x7fffc19a1700
service = 0x9f7920
identifier = 0x7fffc19a1700 ""
resource_urn = 0xdc09e0 "gd:goa-account:account_1438188909_0"
#2 0x000000000044e908 in photos_google_item_create_thumbnail (item=0xbd8840, cancellable=0x0, error=0x7fffc19a0b88)
at photos-google-item.c:141
entry = 0x0
l = 0xd80c80
thumbnails = 0xd23010
thumbnail = 0x0
local_path = 0x0
local_dir = 0x0
local_file = 0x0
remote_file = 0x0
ret_val = 0
thumbnail_uri = 0x0
uri = 0x7ffff113402b <g_source_unref_internal+491> "\351]\377\377\377H\211\337\350\330T\004"
max_width = 0
current_width = 16809983
#3 0x000000000043e5cd in photos_base_item_create_thumbnail_in_thread_func (data=0x7fffc4022ac0, user_data=0x0)
at photos-base-item.c:339
task = 0x7fffc4022ac0
self = 0xbd8840
cancellable = 0x0
error = 0x0
op_res = 0