Print Page | Close Window

Event resize AccessViolationException

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=3688
Printed Date: 01 May 2024 at 8:06pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Event resize AccessViolationException
Posted By: WaaZ
Subject: Event resize AccessViolationException
Date Posted: 22 February 2006 at 10:50am

Hi,

I am having a problem when I resize an event, an AccessViolationException is raised and is unhandled. I am using C# and I really cannot find out which statement is raising this since it does not crash on any of my written codes.

I have implemented EventChanged and before_edit in the code.

Thanks

WaaZ




Replies:
Posted By: sserge
Date Posted: 23 February 2006 at 9:32am
Hi,

Please try to localize a problem.
 
For that you can comment EventChanged and before_edit.
If a problem went out - uncomment some piece of code and test again.
Using this way you can localize it.
May be a problem is not in those handlers, remember what have you changed before it appeared.
 
Also can you send me the code of your EventChanged and before_edit handlers to analyze.

--
WBR,
Serge


Posted By: WaaZ
Date Posted: 08 March 2006 at 12:02pm

Is it possible that if the beforeEditOperation trigger and the EventChanged one cause the accessviolation trigger because some objects are locked.

The two mentionned triggers have some quite complex implementations for me. The EventChanged for instance has operations that do take a lot of time because of network and database operations that need to be completed.

is it possible that if I make changes very quickly.. changes like dragMove and drag_resize that the triggers are called so quickly that an access violation problem is raised? ... maybe because they are trying to reach an object simultaneously



Posted By: WaaZ
Date Posted: 08 March 2006 at 12:27pm

the code crash because of this line on the AccessViolationException:

Application.DoEvents();

quite strange..



Posted By: sserge
Date Posted: 09 March 2006 at 7:09am
Hi,

EventChanged is fired only once for one dragging operation - in its finish to commit changes.
 
BeforeEditOperation is fired for each mouse move for dragging(/resize) operation.
It is called from OnMouseMove window message handler.
 
When you call DoEvents inside BeforeEditOperation, window messages are processed from the message queue and you can enter into OnMouseMove method again and into BeforeEditOperation and again call DoEvents.
 
The call stack is like:
    ...
    DoEvents
    BeforeEditOperation

    OnMouseMove
    DoEvents
    BeforeEditOperation
    OnMouseMove //- initial message
 
I am not sure how DoEvents process messages but you may have stack overflow.
Please check whether is it true or not.
 
Other problem is that CalendarControl::OnMouseMove is not re-enterable.
Each call of OnMouseMove may change dragging context and when we return from subsequent call of BeforeEditOperation the context may be unexpectedly changed. For example we perform dragging but inside BeforeEditOperation OnLButtonUp was processed and the dragging was finished.
 
We do not expect such situation and I am not sure that this is a good way to make OnMouseMove as re-enterable.
 
Do you really need to call DoEvents from BeforeEditOperation each time?
Is it possible to cache some your data once when dragging started? (and so far call DoEvents only once for an operation).
See also IsEditOperationDisabled which is called before dragging started.
 
To avoid such re-entering sometimes one can use a short timer (10-100 ms). I mean that some handler set the request using timer and in the OnTimer I can perform some actions which were not allowed or just not fine inside that handler. I am not sure can this help you or not, but just in case....
 
If the information above was not helpful, please send more details about your logic for EventChanged and BeforeEditOperation methods.

--
WBR,
Serge


Posted By: WaaZ
Date Posted: 13 March 2006 at 9:46am

This is caused, in fact, by Application.doevents() in C#. There may be some concurency control which is going wrong, if multithreading is being used by the activex control.

Thnks




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