CXTPReportControl Access Violation |
Post Reply |
Author | |
lajbr
Newbie Joined: 20 April 2005 Location: Czech Republic Status: Offline Points: 12 |
Post Options
Thanks(0)
Posted: 13 May 2007 at 5:46am |
Hi,
I wrote already that I use CXTPReportControl in my e-mail client to the representation of the e-mail storage. Try to imagine e-mail client similar like example GUI Outlook but with the list of e-mails in this control. I use only one class (because of saving memory space), so when the e-mail folder in the treeview is changed then I clear the previous content, load a new one and draw them by Populate(). The trouble is, that several times I have seen an first-chance exception during loading of the list (after application startup) or during fast switching among directories, when I work with this control very hard (all mentioned operation are done very fast in the sequence). I have a problem with Access violation: First-chance exception at 0x00a03763 in ttt.exe: 0xC0000005: Access violation reading location 0x00000000. Unhandled exception at 0x00a03763 in ttt.exe: 0xC0000005: Access violation reading location 0x00000000. When I debug this problem in VS2005 the problems occurs in xtpreportcontrol.cpp Line 908 because nRowCount (Line 877) has previous not zero value e.g. 1000 (int nRowCount = m_pRows->GetCount();) but CXTPReportRow* pRow = m_pRows->GetAt(i); is NULL and there is no check for validity of pRow but it's directly use at this line and the problem is happend... Lajbr |
|
lajbr
Newbie Joined: 20 April 2005 Location: Czech Republic Status: Offline Points: 12 |
Post Options
Thanks(0)
|
I forgot mentioned that this happend in CodeJock 10.4.2.
Lajbr |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
Hi,
I will add NULL validation here, but this is strange and unexpected error. It looks for me like you work with Report control from different threads: while working thread populating control -- the main thread redraws it. Is it correct? If so, note that Report is not a multi-threaded control - there are no locks inside. You have to add a critical section and enter it before and using control. Or add some other thread synchronization mechanism by yourself. -- WBR, Serge |
|
lajbr
Newbie Joined: 20 April 2005 Location: Czech Republic Status: Offline Points: 12 |
Post Options
Thanks(0)
|
Hi,
yes you are right, because if you load an e-mail folder with e.g. 5000 e-mails or more, then you cannot do it in the main thread... So the loading of content is running in the different thread which is started only for load and the other operation works in the main thread. I suppose that you are right that this is the problem and I solve this synchronization, on the other hand I saw yesterday simmilar problem when the load was started and I move with the mouse, it crash in something (i don't know it directly) which is common with ToolTip text in CXTPReportControl or CXTPReportControlRow. But this is type of operation, which I cannot influence... Lajbr |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
I think you need receive emails in thread and then send message to main thread to repopulate report.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
lajbr
Newbie Joined: 20 April 2005 Location: Czech Republic Status: Offline Points: 12 |
Post Options
Thanks(0)
|
Hi Oleg,
thank for your advice but that's nearly what I'm doing. In the thread I read e-mails from the disk and add them by AddRecord() to the CXTPReportControl or receive & send to the server (add or remove records) in the similar way. When the operation is succesfully done then I call Populate() to the control for ensuring the correct folder content. But I'm doing this Populate in the working thread. I think that doesn't matter if I'm doing the filling and repainting of the CXTPReportControl content in the same thread or in two separate threads. I think the 1st solution is maybe more safety. If the new folder content is required during filling or repaiting of the CXTPReportControl, then I set the sign for skip the previous thread and I'm waiting with WaitForSingleObject() till the first one thread finish. I consult this with my college and I think that it's safe enough for ensure correct thread synchronization and correct thread behaviour. Do you think that there is something wrong? Lajbr |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
you have call Populate in main thread. See our Grep sample - it create records in work thread but call Populate in main.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
lajbr
Newbie Joined: 20 April 2005 Location: Czech Republic Status: Offline Points: 12 |
Post Options
Thanks(0)
|
Hi Oleg,
thanks for your reply. It works now. I used a little different access than it's used in Grep sample but with the same idea. The problem was in collision between AddRecord() and Populate(). After synchronization of these problematic operations it works fine. Lajbr |
|
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 |