From 660d5247006badd07e597194802807dc0fd74d05 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 19 Aug 2006 20:09:33 +0000 Subject: Fixed unintialized data bug in OS X timeout functions. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5336 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 2 ++ src/Fl_mac.cxx | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 8f437fb60..3cd5bab14 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,7 @@ CHANGES IN FLTK 1.1.8 + - Fixed uninitialized data in OS X timout function + (STR #1374). - Fixed speed issues when measuring text on OS X with Quartz (STR #1386). - Fixed focus issues on OS X (STR #1377) diff --git a/src/Fl_mac.cxx b/src/Fl_mac.cxx index b710deb05..9f5a1a74c 100644 --- a/src/Fl_mac.cxx +++ b/src/Fl_mac.cxx @@ -623,12 +623,13 @@ static void realloc_timers() if (mac_timer_alloc == 0) { mac_timer_alloc = 8; } - MacTimeout* new_timers = new MacTimeout[mac_timer_alloc * 2]; - memmove(new_timers, mac_timers, sizeof(MacTimeout) * mac_timer_used); + mac_timer_alloc *= 2; + MacTimeout* new_timers = new MacTimeout[mac_timer_alloc]; + memset(new_timers, 0, sizeof(MacTimeout)*mac_timer_alloc); + memcpy(new_timers, mac_timers, sizeof(MacTimeout) * mac_timer_used); MacTimeout* delete_me = mac_timers; mac_timers = new_timers; delete [] delete_me; - mac_timer_alloc *= 2; } static void delete_timer(MacTimeout& t) -- cgit v1.2.3