![]() |
Event resize AccessViolationException |
Post Reply ![]() |
Author | |
WaaZ ![]() Senior Member ![]() Joined: 31 January 2006 Location: United Kingdom Status: Offline Points: 103 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
sserge ![]() Moderator Group ![]() Joined: 01 December 2004 Status: Offline Points: 1297 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
WaaZ ![]() Senior Member ![]() Joined: 31 January 2006 Location: United Kingdom Status: Offline Points: 103 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
WaaZ ![]() Senior Member ![]() Joined: 31 January 2006 Location: United Kingdom Status: Offline Points: 103 |
![]() ![]() ![]() ![]() ![]() |
the code crash because of this line on the AccessViolationException: Application.DoEvents(); quite strange.. |
|
![]() |
|
sserge ![]() Moderator Group ![]() Joined: 01 December 2004 Status: Offline Points: 1297 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
WaaZ ![]() Senior Member ![]() Joined: 31 January 2006 Location: United Kingdom Status: Offline Points: 103 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |