datetime: Don't unconditionally use self in async cbs
If the page is closed before the async call finishes, the page is unreffed and gets disposed, resulting in a crash when the finish handler is called, as it may try to access pointers of self that got set to NULL in the disposer. To prevent this, use the source object directly, which is guaranteed to be alive during the call and callback. If self gets disposed during the async call, we'll get a warning that the cancellable was cancelled instead of a crash. Fixes #3045
This commit is contained in:
parent
82986f3e92
commit
1c0815490a
1 changed files with 3 additions and 3 deletions
|
@ -256,7 +256,7 @@ set_time_cb (GObject *source,
|
|||
CcDateTimePage *self = user_data;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
if (!timedate1_call_set_time_finish (self->dtm,
|
||||
if (!timedate1_call_set_time_finish (TIMEDATE1 (source),
|
||||
res,
|
||||
&error))
|
||||
{
|
||||
|
@ -277,7 +277,7 @@ set_timezone_cb (GObject *source,
|
|||
CcDateTimePage *self = user_data;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
if (!timedate1_call_set_timezone_finish (self->dtm,
|
||||
if (!timedate1_call_set_timezone_finish (TIMEDATE1 (source),
|
||||
res,
|
||||
&error))
|
||||
{
|
||||
|
@ -294,7 +294,7 @@ set_using_ntp_cb (GObject *source,
|
|||
CcDateTimePage *self = user_data;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
if (!timedate1_call_set_ntp_finish (self->dtm,
|
||||
if (!timedate1_call_set_ntp_finish (TIMEDATE1 (source),
|
||||
res,
|
||||
&error))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue