mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Found and fixed some memory leaks
This commit is contained in:
parent
127e1ef82d
commit
326658929f
@ -77,6 +77,9 @@ END:VTIMEZONE\n";
|
||||
|
||||
char timezonestr[1024];
|
||||
|
||||
if( builtin_timezones )
|
||||
return;
|
||||
|
||||
builtin_timezones = icalarray_new ( 44, 32); //HARDCODED sizeof(icaltimezone)=44
|
||||
|
||||
icalcomponent *vcalendar = icalparser_parse_string(timezonecalstr);
|
||||
@ -391,11 +394,11 @@ NS_IMETHODIMP oeICalContainerImpl::AddEvent( oeIICalEvent *icalevent, const char
|
||||
printf( "oeICalContainerImpl::AddEvent()\n" );
|
||||
#endif
|
||||
nsresult rv;
|
||||
oeIICal *calendar;
|
||||
GetCalendar( server , &calendar );
|
||||
nsCOMPtr<oeIICal> calendar;
|
||||
GetCalendar( server , getter_AddRefs(calendar) );
|
||||
if( !calendar ) {
|
||||
AddCalendar( server );
|
||||
GetCalendar( server , &calendar );
|
||||
GetCalendar( server , getter_AddRefs(calendar) );
|
||||
if( !calendar ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalContainerImpl::AddEvent()-Error cannot find or create calendar\n" );
|
||||
@ -828,11 +831,11 @@ NS_IMETHODIMP oeICalContainerImpl::AddTodo(oeIICalTodo *icaltodo, const char *se
|
||||
printf( "oeICalContainerImpl::AddTodo()\n" );
|
||||
#endif
|
||||
nsresult rv;
|
||||
oeIICal *calendar;
|
||||
GetCalendar(server , &calendar );
|
||||
nsCOMPtr<oeIICal> calendar;
|
||||
GetCalendar( server , getter_AddRefs(calendar) );
|
||||
if( !calendar ) {
|
||||
AddCalendar( server );
|
||||
GetCalendar( server , &calendar );
|
||||
GetCalendar( server , getter_AddRefs(calendar) );
|
||||
if( !calendar ) {
|
||||
#ifdef ICAL_DEBUG
|
||||
printf( "oeICalContainerImpl::AddTodo()-Error cannot find or create calendar\n" );
|
||||
|
@ -1643,6 +1643,7 @@ void oeICalEventImpl::ChopAndAddEventToEnum( struct icaltimetype startdate, nsIS
|
||||
}
|
||||
eventDisplay->SetDisplayEndDate( enddateinms );
|
||||
}
|
||||
NS_RELEASE( eventDisplay );
|
||||
}
|
||||
|
||||
bool oeICalEventImpl::ParseIcalComponent( icalcomponent *comp )
|
||||
@ -2602,7 +2603,6 @@ oeICalEventDisplayImpl::oeICalEventDisplayImpl( oeIICalEvent* event )
|
||||
if( event == nsnull ) {
|
||||
mEvent = do_CreateInstance(OE_ICALEVENTDISPLAY_CONTRACTID, &rv);
|
||||
} else {
|
||||
NS_ADDREF( event );
|
||||
mEvent = event;
|
||||
}
|
||||
|
||||
|
@ -1213,8 +1213,9 @@ oeICalImpl::GetAllEvents(nsISimpleEnumerator **resultList )
|
||||
icaltimetype soonest = icaltime_null_time();
|
||||
eventArray->Count( &num );
|
||||
for ( unsigned int i=0; i<num; i++ ) {
|
||||
oeIICalEvent* tmpevent;
|
||||
eventArray->GetElementAt( i, (nsISupports **)&tmpevent );
|
||||
nsCOMPtr<oeIICalEvent> tmpcomp;
|
||||
eventArray->GetElementAt( i, getter_AddRefs( tmpcomp ) );
|
||||
oeIICalEvent* tmpevent = tmpcomp;
|
||||
icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( now, nsnull );
|
||||
if( !icaltime_is_null_time( next ) )
|
||||
continue;
|
||||
@ -1228,8 +1229,9 @@ oeICalImpl::GetAllEvents(nsISimpleEnumerator **resultList )
|
||||
if( !icaltime_is_null_time( nextcheckdate )) {
|
||||
|
||||
for ( unsigned int i=0; i<num; i++ ) {
|
||||
oeIICalEvent* tmpevent;
|
||||
eventArray->GetElementAt( i, (nsISupports **)&tmpevent );
|
||||
nsCOMPtr<oeIICalEvent> tmpcomp;
|
||||
eventArray->GetElementAt( i, getter_AddRefs( tmpcomp ) );
|
||||
oeIICalEvent* tmpevent = tmpcomp;
|
||||
icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( now, nsnull );
|
||||
if( !icaltime_is_null_time( next ) )
|
||||
continue;
|
||||
@ -1253,8 +1255,9 @@ oeICalImpl::GetAllEvents(nsISimpleEnumerator **resultList )
|
||||
icaltimetype soonest = icaltime_null_time();
|
||||
eventArray->Count( &num );
|
||||
for ( unsigned int i=0; i<num; i++ ) {
|
||||
oeIICalEvent* tmpevent;
|
||||
eventArray->GetElementAt( i, (nsISupports **)&tmpevent );
|
||||
nsCOMPtr<oeIICalEvent> tmpcomp;
|
||||
eventArray->GetElementAt( i, getter_AddRefs( tmpcomp ) );
|
||||
oeIICalEvent* tmpevent = tmpcomp;
|
||||
icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( checkdate, nsnull );
|
||||
next.is_date = false;
|
||||
if( !icaltime_is_null_time( next ) && ( icaltime_is_null_time( soonest ) || (icaltime_compare( soonest, next ) > 0) ) ) {
|
||||
@ -1267,8 +1270,9 @@ oeICalImpl::GetAllEvents(nsISimpleEnumerator **resultList )
|
||||
if( !icaltime_is_null_time( nextcheckdate )) {
|
||||
|
||||
for ( unsigned int i=0; i<num; i++ ) {
|
||||
oeIICalEvent* tmpevent;
|
||||
eventArray->GetElementAt( i, (nsISupports **)&tmpevent );
|
||||
nsCOMPtr<oeIICalEvent> tmpcomp;
|
||||
eventArray->GetElementAt( i, getter_AddRefs( tmpcomp ) );
|
||||
oeIICalEvent* tmpevent = tmpcomp;
|
||||
icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( checkdate, nsnull );
|
||||
next.is_date = false;
|
||||
if( !icaltime_is_null_time( next ) && (icaltime_compare( nextcheckdate, next ) == 0) ) {
|
||||
@ -1451,8 +1455,9 @@ oeICalImpl::GetFirstEventsForRange( PRTime checkdateinms, PRTime checkenddateinm
|
||||
icaltimetype soonest = icaltime_null_time();
|
||||
eventArray->Count( &num );
|
||||
for ( unsigned int i=0; i<num; i++ ) {
|
||||
oeIICalEvent* tmpevent;
|
||||
eventArray->GetElementAt( i, (nsISupports **)&tmpevent );
|
||||
nsCOMPtr<oeIICalEvent> tmpcomp;
|
||||
eventArray->GetElementAt( i, getter_AddRefs( tmpcomp ) );
|
||||
oeIICalEvent* tmpevent = tmpcomp;
|
||||
icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( checkdate, nsnull );
|
||||
next.is_date = false;
|
||||
if( !icaltime_is_null_time( next ) && ( icaltime_is_null_time( soonest ) || (icaltime_compare( soonest, next ) > 0) ) ) {
|
||||
@ -1468,15 +1473,17 @@ oeICalImpl::GetFirstEventsForRange( PRTime checkdateinms, PRTime checkenddateinm
|
||||
if( !icaltime_is_null_time( nextcheckdate )) {
|
||||
|
||||
for ( unsigned int i=0; i<num; i++ ) {
|
||||
oeIICalEvent* tmpevent;
|
||||
eventArray->GetElementAt( i, (nsISupports **)&tmpevent );
|
||||
nsCOMPtr<oeIICalEvent> tmpcomp;
|
||||
eventArray->GetElementAt( i, getter_AddRefs( tmpcomp ) );
|
||||
oeIICalEvent* tmpevent = tmpcomp;
|
||||
bool isbeginning;
|
||||
icaltimetype next = ((oeICalEventImpl *)tmpevent)->GetNextRecurrence( checkdate, nsnull );
|
||||
bool isallday = next.is_date;
|
||||
next.is_date = false;
|
||||
if( !icaltime_is_null_time( next ) && (icaltime_compare( nextcheckdate, next ) == 0) ) {
|
||||
eventEnum->AddEvent( tmpevent );
|
||||
((oeICalEventImpl *)tmpevent)->ChopAndAddEventToEnum( nextcheckdate, eventlist, isallday, isbeginning );
|
||||
eventArray->RemoveElementAt( i );
|
||||
icaltime_adjust( &nextcheckdate, 0, 0, 0, -1 );
|
||||
//TODO Create an eventdisplay object and asd displaydate & displayenddate to it
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user