[Xfce4-commits] <orage:master> 4.9.6.1 Fixed error in handling orage_localtime() returned tm data

Juha Kautto noreply at xfce.org
Mon Nov 4 13:32:01 CET 2013


Updating branch refs/heads/master
         to d4118b6846a41316bf47a23b24d395245d9d0b34 (commit)
       from 7b79f626d9fe6fe7d0cf9ce7b1590d0b852bd8ca (commit)

commit d4118b6846a41316bf47a23b24d395245d9d0b34
Author: Juha Kautto <juha at xfce.org>
Date:   Mon Nov 4 14:27:53 2013 +0200

    4.9.6.1 Fixed error in handling orage_localtime() returned tm data
    
    Wrong times was used because of direct modification of tm value
    returned from orage_localtime(). Local variable needs to be
    used if that value is modified.

 configure.in.in    |    2 +-
 src/ical-archive.c |    4 +++-
 src/reminder.c     |    9 ++++-----
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/configure.in.in b/configure.in.in
index 459d305..4bf31ae 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -9,7 +9,7 @@ dnl Written for Xfce by Juha Kautto <juha at xfce.org>
 dnl
 
 dnl Version information
-m4_define([orage_version], [4.9.6.0-git])
+m4_define([orage_version], [4.9.6.1-git])
 
 m4_define([gtk_minimum_version], [2.14.0])
 m4_define([xfce_minimum_version], [4.8.0])
diff --git a/src/ical-archive.c b/src/ical-archive.c
index e870058..deeb61b 100644
--- a/src/ical-archive.c
+++ b/src/ical-archive.c
@@ -319,6 +319,7 @@ gboolean xfical_archive(void)
     xfical_period per;
     icalcomponent *c, *c2;
     icalproperty *p;
+    struct tm tm_threshold;
     struct tm *threshold;
     char *uid;
 
@@ -333,7 +334,8 @@ gboolean xfical_archive(void)
         orage_message(250, P_N "file open error");
         return(FALSE);
     }
-    threshold = orage_localtime();
+    memcpy(&tm_threshold, orage_localtime(), sizeof(tm_threshold));
+    threshold=&tm_threshold;
     threshold->tm_mday = 1;
     threshold->tm_year += 1900;
     threshold->tm_mon += 1; /* convert from 0...11 to 1...12 */
diff --git a/src/reminder.c b/src/reminder.c
index 980cb5b..6829f1e 100644
--- a/src/reminder.c
+++ b/src/reminder.c
@@ -988,7 +988,6 @@ static gboolean orage_alarm_clock(gpointer user_data)
 {
 #undef P_N
 #define P_N "orage_alarm_clock: "
-    struct tm *t;
     GList *alarm_l;
     alarm_struct *cur_alarm;
     gboolean alarm_raised=FALSE;
@@ -998,8 +997,7 @@ static gboolean orage_alarm_clock(gpointer user_data)
 #ifdef ORAGE_DEBUG
     orage_message(-100, P_N);
 #endif
-    t = orage_localtime();
-    time_now = orage_tm_time_to_icaltime(t);
+    time_now = orage_tm_time_to_icaltime(orage_localtime());
   /* Check if there are any alarms to show */
     for (alarm_l = g_list_first(g_par.alarm_list);
          alarm_l != NULL && more_alarms;
@@ -1027,7 +1025,7 @@ static void reset_orage_alarm_clock(void)
 {
 #undef P_N
 #define P_N "reset_orage_alarm_clock: "
-    struct tm *t, t_alarm;
+    struct tm *t, t_alarm, t2;
     GList *alarm_l;
     alarm_struct *cur_alarm;
     gchar *next_alarm;
@@ -1042,7 +1040,8 @@ static void reset_orage_alarm_clock(void)
         g_par.alarm_timer = 0;
     }
     if (g_par.alarm_list) { /* we have alarms */
-        t = orage_localtime();
+        memcpy(&t2, orage_localtime(), sizeof(t2));
+        t = &t2;
         t->tm_mon++;
         t->tm_year = t->tm_year + 1900;
         alarm_l = g_list_first(g_par.alarm_list);


More information about the Xfce4-commits mailing list