Skip to content

Commit

Permalink
gh#1463 don't pass recycle to functions that can thrash it
Browse files Browse the repository at this point in the history
when subsequent uses _do_ depend on (part of) the value thereof.
  • Loading branch information
Lionel Mamane committed Oct 6, 2023
1 parent bf48961 commit 983b9a9
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,11 @@ public CalendarAppWidgetModel(Context context, String timeZone) {
}

public void buildFromCursor(Cursor cursor, String timeZone) {
final Time recycle = new Time(timeZone);
final ArrayList<LinkedList<RowInfo>> mBuckets =
new ArrayList<LinkedList<RowInfo>>(CalendarAppWidgetService.MAX_DAYS);
for (int i = 0; i < CalendarAppWidgetService.MAX_DAYS; i++) {
mBuckets.add(new LinkedList<RowInfo>());
}
recycle.set(System.currentTimeMillis());
mShowTZ = !TextUtils.equals(timeZone, Utils.getCurrentTimezone());
if (mShowTZ) {
mHomeTZName = TimeZone.getTimeZone(timeZone).getDisplayName(false, TimeZone.SHORT);
Expand All @@ -93,6 +91,7 @@ public void buildFromCursor(Cursor cursor, String timeZone) {

// Adjust all-day times into local timezone
if (allDay) {
final Time recycle = new Time();
start = Utils.convertAlldayUtcToLocal(recycle, start, tz);
end = Utils.convertAlldayUtcToLocal(recycle, end, tz);
}
Expand Down Expand Up @@ -131,6 +130,7 @@ public void buildFromCursor(Cursor cursor, String timeZone) {
if (!bucket.isEmpty()) {
// We don't show day header in today
if (day != mTodayJulianDay) {
final Time recycle = new Time(timeZone);
final DayInfo dayInfo = populateDayInfo(day, recycle);
// Add the day header
final int dayIndex = mDayInfos.size();
Expand Down

0 comments on commit 983b9a9

Please sign in to comment.