Jump to content


Photo

Few minor problems with grid in slide mode


  • Please log in to reply
90 replies to this topic

#21 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 01:23 AM

Hello Saurman,

Do you maybe have succedd to spot when this problem occur? Having RowExist should prevent any AV from this procedure sad.gif

Does maybe happen when you modify data inside grid?

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#22 Saurman

Saurman
  • Members
  • 44 posts

Posted 04 December 2007 - 01:40 AM

well, i can only say that grid is manually filled with data from database and have tree-type column. In most cases, an AV occurs for a row, which goes right after last child (A->A1,A2,A3,A4; B->B1,B2; C->C1 <--- in that case this will be B and C rows). RowExists doesnt fix the problem. What about paint bug?

#23 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 02:03 AM

Hello Saurman,

Unfortunatelly, I still can't spot it. If you may buid me one small sample project maybe this will help me. I am also a little bit confused about in which GridStyle (report or slide) bug appear smile.gif

I will look at paint bug.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#24 Saurman

Saurman
  • Members
  • 44 posts

Posted 04 December 2007 - 03:56 PM

k, here is a test app. If u dont have Mad Except, get it here (http://madshi.net/) or remove all "Mad...." units from project file. I used Delplhi7.
Attached File  AV_test.zip   740.93KB   6 downloads

Try this:
1) Mode - separate thread, rows count - 1000, loop until av - yes. The produce EListError AV, somewhere in ClearRows (see bugreport.txt in project folder)
2) try to play with other modes, recommend to put it into continuous loop and leave for a few hours with ide attached.


Cheers Boki

#25 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 08:01 PM

Hello Saurman,

Thank you for your sample. I have played with Exe but not yet spot AV. I will now try with source code too.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#26 Saurman

Saurman
  • Members
  • 44 posts

Posted 04 December 2007 - 08:23 PM

well. maybe its due to my os is Vista. #1 usually porduces an AV at 2nd-5th iteration

#27 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 08:33 PM

Hello Saurman,

I have test it for about 20 minutes and no AV to jump sad.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#28 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 08:58 PM

Hello Saurman,

I have spot it. This AV is definitelly related to Thread. Most probably application start another thread when previous thread is not finished or something similar.

I will need some time to find how to solve this problem.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#29 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 09:15 PM

Hello Saurman,

Yes, definitelly it is related to Threads. It only occur when using Threads in your sample.

Problem most probably occur when in few mseconds, cell is deleted but drawing cell is already started.

Maybe you can try to use some flag, to not update grid until deleting/adding rows is finished? This will most probably help. It will be bad for Grid performance if I put if CellExist(X, Y) on many places and even this doesn't guarantee that cell will exist in next ms sad.gif

If someone have some suggestion about this issue, I will like to hear smile.gif

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#30 Saurman

Saurman
  • Members
  • 44 posts

Posted 04 December 2007 - 09:30 PM

can u explain, how can drawing start if iam using begin update? Can this be recoded in such a way, if u enter no-update mode, there will be no any drawings. Or atleast a separate function to disable drawings while updating grid content.

Also i still dont get it, how can grid be repainted while its deleting rows. Is it multi-threaded? But i think, 2 functions for blocking/unblocking any updates is a perfect solution

#31 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 09:40 PM

Hello Saurman,

Most probably, because threads are goin to fast, one thread delete row but second thread send message to redraw cells. Also, same happen when you move mouse over cells and grid will try to display hint. While I move mouse for few pixels, cell is already deleted by another thread and when grid try to display hint it come into a empty area.

I will need to do a serious investigations about this, maybe to somehow lock-up grid.

Please note that I will need some time to complete this. I suggest that you try to include some flags in your app, to block executing second thread if one is not finished.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#32 Saurman

Saurman
  • Members
  • 44 posts

Posted 04 December 2007 - 10:00 PM

what u mean second? i have only one, just like in test application. Or do u mean ur thread, which redraws grid?

#33 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 10:26 PM

Hello Saurman,

Yes TTestThread thread. This thread calls DoGridFullUpdate infinitely, but second created thread not wait untill first one finish. You may note that when you click on button only (without Repeat until AV... checkbox checked), all work fine if you don't click on button in few mseconds smile.gif

I hope that this help you. I will definitelly try to find solution for this situations, but I think that you may prevent this in your application too.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#34 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 10:40 PM

Hello,

One correction. You don't create too many threads, but thread calls DoGridFullUpdate to fast.

I will try now, in your demo to add some flag to prevent this.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#35 Saurman

Saurman
  • Members
  • 44 posts

Posted 04 December 2007 - 10:53 PM

second thread? hmm, have u looked at unit2 - TTestThread.Execute? Loop is inside execute. Thread started once, and terminated on request, so actually, from my threads, only one is active.

Edit: exactly

#36 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 10:58 PM

Hello Saurman,

I have add corection in post #34. Definitelly, somehow Grid need to be locked while one DoGridFullUpdate is done.

I will need more time to see how this may be solved. I suggest that you try something with using Boolean variable, to prevent new execution of DoGridFullUpdate untill previous one.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#37 Saurman

Saurman
  • Members
  • 44 posts

Posted 04 December 2007 - 11:05 PM

i still dont get it, how can it execute new DoGridFullUpdate when previous isnt finished? Boki, its all in same thread. Procedure is called on each loop step. Step is not finished until procedure is running.

#38 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 11:17 PM

Hello Saurman,

Correctly, it is still same thread but Grid didn't finished with drawing request from operation from previous DoGridFullUpdate and new DoGridFullUpdate is on run and delete cell which is already in drawn process. This is why AV on procedures like GetCellRect, RowVisible, GetRowHeight.

Grid is in separate thread from your thread. I will definitelly need more time to inspect this problem to made grid 100% thread safe.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#39 Saurman

Saurman
  • Members
  • 44 posts

Posted 04 December 2007 - 11:20 PM

well, can u have some flag, which will be triggered when painting is finished, or maybe make drawing blocking (wait thread). boki, do u have msn messenger?

#40 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,195 posts
  • Gender:Male

Posted 04 December 2007 - 11:23 PM

Here is a more detailed process (maybe I am in wrong, but I hope that this is it):

- DoGridFullUpdate started
- Rows are cleared
- Rows are added and cells are set
- Drawing procedures of grid are started (we are re-drawing cells)
- We are inspecting Cell's TRect, Cell's text...for example Cell(1, 5);
- DoGridFullUpdate is started again and Rows are cleared again.
- We are finishing drawing for Cell(1, 5), but oops cell is not here!
- AV occur.

I hope that this helps. I will look somehow to add some methods in grid to prevent this situations, maybe Lock procedure or something similar.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users