Print Page | Close Window

CXTPCalendarRemindersManager::Dismiss()

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=15931
Printed Date: 07 July 2024 at 8:51am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPCalendarRemindersManager::Dismiss()
Posted By: mitcheljh
Subject: CXTPCalendarRemindersManager::Dismiss()
Date Posted: 28 December 2009 at 7:48pm
After having problems dismissing reminders, I took a look at
CXTPCalendarRemindersManager::Dismiss(CXTPCalendarReminder* pReminder),
and from all indications, the function seems to be operating on a reminder pointer after it has been deleted.

In the function, the reminder is first removed from the active reminders array. Stepping through the RemoveAt() function shows the destructor of the removed reminder is being explicitly called when its removed from the array. The debugger also shows that reminder as being deallocated.

Afterwards, the pointer to the deleted reminder is passed to the _Dismiss() operation, which fails for me, because that object is already deleted.

Should I be calling this Dismiss() operation with a cloned reminder? If so, I can't seem to find a clone operation for this object.

Thanks for any help,

Mitchel



Replies:
Posted By: mitcheljh
Date Posted: 28 December 2009 at 9:26pm
I found the solution.
I should have investigated a little more before posting, sorry. Rather than remove the post, I think I'll leave it for anyone else with the same issue.

I was using...
CXTPCalendarReminders::GetAt(int idx)
to retrieve the pointer to the reminder I wanted to dismiss.
By using this instead...
CXTPCalendarReminders::GetAt(int idx, BOOL withAddRef)
and passing TRUE, to add an internal reference to the returned reminder, I was able to call dismiss on that reminder without incident. (I also needed to delete the reminder pointer manually, since I increased the reference for it).

I should note also, I'm using my own custom dialog for reminders, which is why I'm needing to call these operations in the first place.

Anyway, all is well.

Thanks,

Mitchel



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net