Skip to content

Commit 5f6f265

Browse files
committed
local: don't remove handlers in finalization
Require all handlers to be deregistered by their users before the local finalization.
1 parent bf92314 commit 5f6f265

File tree

7 files changed

+20
-7
lines changed

7 files changed

+20
-7
lines changed

local.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,11 @@ LCL_Initialise(void)
185185
void
186186
LCL_Finalise(void)
187187
{
188-
while (change_list.next != &change_list)
189-
LCL_RemoveParameterChangeHandler(change_list.next->handler,
190-
change_list.next->anything);
191-
192-
while (dispersion_notify_list.next != &dispersion_notify_list)
193-
LCL_RemoveDispersionNotifyHandler(dispersion_notify_list.next->handler,
194-
dispersion_notify_list.next->anything);
188+
/* Make sure all handlers have been removed */
189+
if (change_list.next != &change_list)
190+
assert(0);
191+
if (dispersion_notify_list.next != &dispersion_notify_list)
192+
assert(0);
195193
}
196194

197195
/* ================================================== */

manual.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ MNL_Initialise(void)
9292
void
9393
MNL_Finalise(void)
9494
{
95+
LCL_RemoveParameterChangeHandler(slew_samples, NULL);
9596
}
9697

9798
/* ================================================== */

ntp_sources.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ NSR_Finalise(void)
185185
clean_source_record(record);
186186
}
187187

188+
LCL_RemoveParameterChangeHandler(slew_sources, NULL);
189+
188190
ARR_DestroyInstance(records);
189191
ARR_DestroyInstance(pools);
190192

reference.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ REF_Finalise(void)
304304
update_drift_file(LCL_ReadAbsoluteFrequency(), our_skew);
305305
}
306306

307+
LCL_RemoveParameterChangeHandler(handle_slew, NULL);
308+
307309
Free(fb_drifts);
308310

309311
initialised = 0;

rtc_linux.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,10 @@ RTC_Linux_Finalise(void)
573573
(void) RTC_Linux_WriteParameters();
574574

575575
}
576+
577+
if (rtc_sec)
578+
LCL_RemoveParameterChangeHandler(slew_samples, NULL);
579+
576580
Free(rtc_sec);
577581
Free(rtc_trim);
578582
Free(system_times);

smooth.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ void SMT_Initialise(void)
272272

273273
void SMT_Finalise(void)
274274
{
275+
if (!enabled)
276+
return;
277+
278+
LCL_RemoveParameterChangeHandler(handle_slew, NULL);
275279
}
276280

277281
int SMT_IsEnabled(void)

sys_generic.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ SYS_Generic_Finalise(void)
417417

418418
LCL_ReadRawTime(&now);
419419
stop_fastslew(&now);
420+
421+
LCL_RemoveParameterChangeHandler(handle_step, NULL);
420422
}
421423

422424
/* ================================================== */

0 commit comments

Comments
 (0)