Merge lp:~laney/notify-osd/no-double-g_source_remove into lp:notify-osd

Proposed by Iain Lane
Status: Merged
Approved by: Lars Karlitski
Approved revision: 480
Merged at revision: 478
Proposed branch: lp:~laney/notify-osd/no-double-g_source_remove
Merge into: lp:notify-osd
Diff against target: 70 lines (+9/-13)
1 file modified
src/timings.c (+9/-13)
To merge this branch: bzr merge lp:~laney/notify-osd/no-double-g_source_remove
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Lars Karlitski (community) Approve
Review via email: mp+198283@code.launchpad.net

Commit message

Clear the reference when we g_source_remove the timers so we don't attempt to remove them again in the dispose function.

Description of the change

Clear the reference when we g_source_remove the timers so we don't attempt to remove them again in the dispose function.

Also get rid of unnecessary g_assert()s

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
480. By Iain Lane

Kill the now useless booleans

Revision history for this message
Lars Karlitski (larsu) wrote :

Thumbs up. Extra points for removing the misleading "try" in the comments.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/timings.c'
2--- src/timings.c 2011-07-01 18:23:39 +0000
3+++ src/timings.c 2013-12-09 16:19:02 +0000
4@@ -332,7 +332,6 @@
5 timings_stop (Timings* t)
6 {
7 TimingsPrivate* priv;
8- gboolean removed_successfully;
9
10 // sanity checks
11 if (!t)
12@@ -356,13 +355,13 @@
13 if (!priv->is_paused)
14 {
15 // remove timeout for normal scheduled duration
16- removed_successfully = g_source_remove (priv->timeout_id);
17- g_assert (removed_successfully);
18+ g_source_remove (priv->timeout_id);
19+ priv->timeout_id = 0;
20 }
21
22 // remove timeout enforcing max. time-limit
23- removed_successfully = g_source_remove (priv->max_timeout_id);
24- g_assert (removed_successfully);
25+ g_source_remove (priv->max_timeout_id);
26+ priv->max_timeout_id = 0;
27
28 // halt all timers
29 if (priv->is_paused)
30@@ -387,7 +386,6 @@
31 timings_pause (Timings* t)
32 {
33 TimingsPrivate* priv;
34- gboolean removed_successfully;
35
36 // sanity checks
37 if (!t)
38@@ -421,9 +419,9 @@
39 g_timer_stop (priv->duration_timer);
40 priv->is_paused = TRUE;
41
42- // try to get rid of old timeout
43- removed_successfully = g_source_remove (priv->timeout_id);
44- g_assert (removed_successfully);
45+ // get rid of old timeout
46+ g_source_remove (priv->timeout_id);
47+ priv->timeout_id = 0;
48
49 return TRUE;
50 }
51@@ -482,7 +480,6 @@
52 guint extension)
53 {
54 TimingsPrivate* priv;
55- gboolean removed_successfully;
56 guint on_screen_time; // value interpreted as milliseconds
57
58 // sanity checks
59@@ -513,9 +510,8 @@
60 return TRUE;
61 }
62
63- // try to get rid of old timeout
64- removed_successfully = g_source_remove (priv->timeout_id);
65- g_assert (removed_successfully);
66+ // get rid of old timeout
67+ g_source_remove (priv->timeout_id);
68
69 // ensure we don't overshoot limit with the on-screen time
70 on_screen_time = _ms_elapsed (priv->duration_timer);

Subscribers

People subscribed via source and target branches