Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 15 total
Thread Getting an AV on closing a query v3.30
Mon, Jun 19 2006 11:59 PMPermanent Link

Jeff Cook
Hi

I've got a really odd situation where I get an AV on closing a query.  

I open this query at the start of the module with the "ActivateQuery" procedure below.  I then use the resulting dataset in a grid and use it to step through deleting records from a table.  At the end of this batch deletion I attempt to reopen query with the "ActivateQuery" procedure, but get an AV.  

I have very similar code operating on different tables and that works OK, it is just this module and I can't see why a Close would cause an AV.

Any help appreciated!

Cheers

Jeff
=======================================================
procedure TUnusedProperties.ActivateQuery;
begin
 Screen.Cursor := crSQLWait;
 try
   qryProperties.Close; //  <<<<<<<<<< AV here!
   StatusBar1.Panels[0].Text := 'Checking Properties';
   Application.ProcessMessages;
   qryProperties.Open;
   StatusBar1.Panels[0].Text := IntToStr(qryProperties.RecordCount)
     + ' Properties found';
 finally
   Screen.Cursor := crDefault;
 end;
 btnPrint.SetFocus;        
end;
=====================================================
The SQL is unremarkable:-

SELECT P.StreetNumber, P.StreetName, P.Suburb, P.PropertyCode,
      IF(P.Managed THEN "Yes" ELSE "No") AS Managed,
      L.LandlordCode, L.SortKey, True AS Selected
FROM Properties P
JOIN Landlords L ON (L.LandlordCode = P.LandlordCode)
WHERE P.PropertyCode NOT IN (SELECT DISTINCT PropertyCode FROM Tenants)
ORDER BY P.StreetName, P.StreetNumber
======================================================
madExcept said this (some of which might be useful!) and more :-

DBISAM Version : 3.30
Session.RemoteAddress: 127.0.0.1
Session.Host: localhost
Remote.Type: rtLAN
Session.Type: stLocal

date/time         : 2006-06-20, 15:04:55, 250ms
computer name     : ASL3
user name         : Jeff Cook <admin>
operating system  : Windows XP Service Pack 2 build 2600
system language   : English
system up time    : 21 hours 51 minutes
program up time   : 28 seconds
processor         : Intel(R) Pentium(R) 4 CPU 2.40GHz
physical memory   : 38/479 MB (free/total)
free disk space   : (CSmile9.08 GB
display mode      : 1024x768, 32 bit
process id        : $7f0
allocated memory  : 13.52 MB
executable        : apm.exe
exec. date/time   : 2006-06-20 15:03
version           : 3.9.10.6
madExcept version : 3.0a
contact name      : Jeff
contact email     : jeffc@aspect.co.nz
callstack crc     : $c0142c86, $9bc3bcbd, $9bc3bcbd
exception number  : 1
exception class   : EAccessViolation
exception message : Access violation at address 0054A38C in module 'apm.exe'. Read of address 00000004.

main thread ($f4c):
0054a38c +000 apm.exe    dbisamen                            TDataCursor.CheckForChangeDetection
0055f21d +021 apm.exe    dbisamen                            TDataCursor.ResetFilter
004fa14e +03e apm.exe    dbisamsq                            TDataQuery.BuildSubSelectFilter
00561589 +035 apm.exe    dbisamen                            TDataCursor.EvaluateFilterForRecord
00561456 +07e apm.exe    dbisamen                            TDataCursor.NavigateNonIndexedRecords
005476cc +034 apm.exe    dbisamen                            TFilter.BuildNonIndexedBitmap
00546933 +a3f apm.exe    dbisamen                            TFilter.EvaluateFilter
00545e21 +021 apm.exe    dbisamen                            TFilter.Update
00560b0f +19b apm.exe    dbisamen                            TDataCursor.UpdateAllFilters
005569d3 +017 apm.exe    dbisamen                            TDataCursor.RefreshRangeAndFilters
0054a36e +026 apm.exe    dbisamen                            TDataCursor.CheckForCursorChanges
0054a3a1 +015 apm.exe    dbisamen                            TDataCursor.CheckForChangeDetection
0055ef86 +156 apm.exe    dbisamen                            TDataCursor.DropFilter
004eb449 +011 apm.exe    dbisamsq                            TJoin.FreeJoinFilterHandle
004eaf81 +00d apm.exe    dbisamsq                            TJoin.Destroy
004042f4 +008 apm.exe    System                              TObject.Free
004eb98c +020 apm.exe    dbisamsq                            TSourceTable.FreeJoins
004edd83 +023 apm.exe    dbisamsq                            TDataQuery.FreeSourceTables
004edadc +018 apm.exe    dbisamsq                            TDataQuery.Destroy
004042f4 +008 apm.exe    System                              TObject.Free
004ed2aa +01a apm.exe    dbisamsq                            TQueryStatement.FreeDataQueries
004ec6c2 +096 apm.exe    dbisamsq                            TQueryStatement.Destroy
004042f4 +008 apm.exe    System                              TObject.Free
0058476d +00d apm.exe    DBISAMTb                            TDBISAMQuery.FreeStatement
0058472a +086 apm.exe    DBISAMTb                            TDBISAMQuery.SetPrepared
00584dfc +050 apm.exe    DBISAMTb                            TDBISAMQuery.SetDBFlag
005804ba +012 apm.exe    DBISAMTb                            TDBISAMDBDataSet.CloseCursor
004e10c7 +0a7 apm.exe    DB                                  TDataSet.SetActive
004e0ecc +004 apm.exe    DB                                  TDataSet.Close
007e060b +043 apm.exe    RptA29UnusedPropertiesList  100  +3 TUnusedProperties.ActivateQuery
007e0e45 +1a5 apm.exe    RptA29UnusedPropertiesList  249 +33 TUnusedProperties.btnDeleteSelectedClick
0049f89c +064 apm.exe    Controls                            TControl.Click
0048bce8 +01c apm.exe    StdCtrls                            TButton.Click
004c5a49 +065 apm.exe    Buttons                             TBitBtn.Click
0048bddc +00c apm.exe    StdCtrls                            TButton.CNCommand
0049f704 +188 apm.exe    Controls                            TControl.WndProc
004a272f +157 apm.exe    Controls                            TWinControl.WndProc
0048bc5c +06c apm.exe    StdCtrls                            TButtonControl.WndProc
0049f4d4 +024 apm.exe    Controls                            TControl.Perform
004a2867 +023 apm.exe    Controls                            DoControlMsg
004a2ec3 +00b apm.exe    Controls                            TWinControl.WMCommand
0049f704 +188 apm.exe    Controls                            TControl.WndProc
004a272f +157 apm.exe    Controls                            TWinControl.WndProc
004a23ac +02c apm.exe    Controls                            TWinControl.MainWndProc
004746c0 +014 apm.exe    Classes                             StdWndProc
77d4b8fe +044 user32.dll                                     SendMessageW
77d4e900 +016 user32.dll                                     CallWindowProcA
004a2813 +0d7 apm.exe    Controls                            TWinControl.DefaultHandler
0049fca4 +010 apm.exe    Controls                            TControl.WMLButtonUp
0049f704 +188 apm.exe    Controls                            TControl.WndProc
004a272f +157 apm.exe    Controls                            TWinControl.WndProc
0048bc5c +06c apm.exe    StdCtrls                            TButtonControl.WndProc
004a23ac +02c apm.exe    Controls                            TWinControl.MainWndProc
004746c0 +014 apm.exe    Classes                             StdWndProc
77d496c2 +00a user32.dll                                     DispatchMessageA
004bf797 +083 apm.exe    Forms                               TApplication.ProcessMessage
004bf7ce +00a apm.exe    Forms                               TApplication.HandleMessage
004bc633 +147 apm.exe    Forms                               TCustomForm.ShowModal
008a46ee +052 apm.exe    apmMain                    4650  +5 TmainForm.menuAdminUnusedPropertiesClick
004b05fe +0a6 apm.exe    Menus                               TMenuItem.Click
004b17d7 +013 apm.exe    Menus                               TMenu.DispatchCommand
004bb103 +01f apm.exe    Forms                               TCustomForm.WMCommand
0049f704 +188 apm.exe    Controls                            TControl.WndProc
004a272f +157 apm.exe    Controls                            TWinControl.WndProc
004b9235 +421 apm.exe    Forms                               TCustomForm.WndProc
004c180f +09b apm.exe    JvWndProcHook                       TJvHookInfos.WindowProc
004a23ac +02c apm.exe    Controls                            TWinControl.MainWndProc
004746c0 +014 apm.exe    Classes                             StdWndProc
77d496c2 +00a user32.dll                                     DispatchMessageA
004bf797 +083 apm.exe    Forms                               TApplication.ProcessMessage
004bf7ce +00a apm.exe    Forms                               TApplication.HandleMessage
004bf9ee +096 apm.exe    Forms                               TApplication.Run
008a95de +0ba apm.exe    apm                         279 +12 initialization

thread $6ac (TIdIPWatchThread):
7c90eb94 +00 ntdll.dll              KiFastSystemCallRet
7c90d85a +0a ntdll.dll              NtDelayExecution
7c8023e7 +4b kernel32.dll           SleepEx
7c80244c +0a kernel32.dll           Sleep
0088edb2 +26 apm.exe      IdIPWatch TIdIPWatchThread.Run
0088e4fd +5d apm.exe      IdThread  TIdThread.Execute
0044e367 +2b apm.exe      madExcept HookedTThreadExecute
00472b88 +34 apm.exe      Classes   ThreadProc
00405160 +28 apm.exe      System    ThreadWrapper
0044e271 +0d apm.exe      madExcept CallThreadProc
0044e2b3 +37 apm.exe      madExcept ThreadExceptFrame
>> created by main thread ($f4c) at:
0088e5bb +1f apm.exe      IdThread  TIdThread.Create

thread $704:
7c90eb94 +00 ntdll.dll            KiFastSystemCallRet
7c90e397 +0a ntdll.dll            NtReplyWaitReceivePortEx
0044e271 +0d apm.exe    madExcept CallThreadProc
0044e2b3 +37 apm.exe    madExcept ThreadExceptFrame
>> created by main thread ($f4c) at:
77e8760d +00 rpcrt4.dll

thread $d44:
7c90eb94 +00 ntdll.dll              KiFastSystemCallRet
7c90d85a +0a ntdll.dll              NtDelayExecution
7c8023e7 +4b kernel32.dll           SleepEx
7c80244c +0a kernel32.dll           Sleep
0044e271 +0d apm.exe      madExcept CallThreadProc
0044e2b3 +37 apm.exe      madExcept ThreadExceptFrame
>> created by main thread ($f4c) at:
7750cc4a +00 ole32.dll

stack dump:
0013ea6c  22 f2 55 00 b0 df b8 02 - 1c a1 cb 02 b0 df b8 02  ".U............. 0013ea7c  00 00 00 00 4b 1e 00 00 - 01 00 00 00 a8 f5 50 00  ....K.........P. 0013ea8c  de 51 51 00 dc df ba 02 - 40 2f 51 00 e5 3d 51 00  .QQ.....@/Q..=Q. 0013ea9c  ed 3d 51 00 18 9c ba 02 - c3 23 40 00 c8 b5 8b 00  .=Q......#@..... 0013eaac  3a 4c 40 00 42 23 40 00 - 14 eb 13 00 c4 23 40 00  :L@.B#@......#@. 0013eabc  d4 ea 13 00 b0 df b8 02 - a0 4f cb 02 00 01 00 00  .........O...... 0013eacc  10 2f cb 02 5c 13 cb 02 - fc ea 13 00 1b 28 40 00  ./..\........(@. 0013eadc  b0 df b8 02 80 36 45 00 - a0 4f cb 02 00 01 00 00  .....6E..O...... 0013eaec  70 60 51 00 2c eb 13 00 - b0 df b8 02 17 00 00 00  p`Q.,........... 0013eafc  c0 4d 2f 01 a4 9f 46 00 - 50 eb 13 00 b0 df b8 02  .M/...F.P....... 0013eb0c  50 eb 13 00 b0 df b8 02 - b0 df b8 02 a0 97 c9 02  P............... 0013eb1c  50 eb 13 00 b0 df b8 02 - 9c 4f cb 02 a0 97 c9 02  P........O...... 0013eb2c  45 9f 46 00 ac b8 c9 02 - dc a1 4f 00 b0 df b8 02  E.F.......O..... 0013eb3c  84 20 cb 02 1c a1 cb 02 - 00 24 cb 02 b0 df b8 02  .........$...... 0013eb4c  b0 df b8 02 7c eb 13 00 - ab a2 4f 00 00 00 50 00  ....|.....O...P. 0013eb5c  00 00 50 00 64 3f 50 00 - b0 df b8 02 1c a1 cb 02  ..P.d?P......... 0013eb6c  b0 df b8 02 00 00 00 00 - b0 df b8 02 b0 df b8 02  ................ 0013eb7c  28 ed 13 00 84 20 cb 02 - 00 00 00 00 28 ed 13 00  (...........(... 0013eb8c  53 a1 4f 00 b0 18 cb 02 - 1c a1 cb 02 97 8c 52 00  S.O...........R. 0013eb9c  68 ed 13 00 b0 4a 40 00 - 28 ed 13 00 b0 18 cb 02  h....J@.(.......

disassembling:
[...]
007e05f7       push    $7e06ac                ; System.@HandleFinally
007e05fc       push    dword ptr fs:[eax]
007e05ff       mov     fs:[eax], esp
007e0602 100   mov     eax, [ebp-4]
007e0605       mov     eax, [eax+$380]
007e060b     > call    -$2ff748 ($4e0ec8)     ; DB.TDataSet.Close
007e0610 101   mov     eax, [ebp-4]
007e0613       mov     eax, [eax+$460]
007e0619       mov     eax, [eax+$208]
007e061f       xor     edx, edx
007e0621       call    -$2312f6 ($5af330)     ; ComCtrls.TStatusPanels.GetItem
[...]





--
Jeff Cook
Aspect Systems Ltd
Phone: +64-9-424 5388
Skype: jeffcooknz
www.aspect.co.nz



Tue, Jun 20 2006 12:09 AMPermanent Link

Steve Forbes

Team Elevate Team Elevate

Hi Jeff,

You don't have an event hooked into the query or attached dataset that is
trying to fire against the closed dataset do you?

--
Best regards

Steve
"Jeff Cook" <jeffc@aspect.co.nz> wrote in message
news:070694F9-199D-4ECD-9BDE-B807B2E31130@news.elevatesoft.com...
> Hi
>
> I've got a really odd situation where I get an AV on closing a query.
>
> I open this query at the start of the module with the "ActivateQuery"
> procedure below. I then use the resulting dataset in a grid and use it to
> step through deleting records from a table. At the end of this batch
> deletion I attempt to reopen query with the "ActivateQuery" procedure, but
> get an AV.
>
> I have very similar code operating on different tables and that works OK,
> it is just this module and I can't see why a Close would cause an AV.
>
> Any help appreciated!
>
> Cheers
>
> Jeff
> =======================================================
> procedure TUnusedProperties.ActivateQuery;
> begin
> Screen.Cursor := crSQLWait;
> try
> qryProperties.Close; // <<<<<<<<<< AV here!
> StatusBar1.Panels[0].Text := 'Checking Properties';
> Application.ProcessMessages;
> qryProperties.Open;
> StatusBar1.Panels[0].Text := IntToStr(qryProperties.RecordCount)
> + ' Properties found';
> finally
> Screen.Cursor := crDefault;
> end;
> btnPrint.SetFocus;
> end;
> =====================================================
> The SQL is unremarkable:-
>
> SELECT P.StreetNumber, P.StreetName, P.Suburb, P.PropertyCode,
> IF(P.Managed THEN "Yes" ELSE "No") AS Managed,
> L.LandlordCode, L.SortKey, True AS Selected
> FROM Properties P
> JOIN Landlords L ON (L.LandlordCode = P.LandlordCode)
> WHERE P.PropertyCode NOT IN (SELECT DISTINCT PropertyCode FROM Tenants)
> ORDER BY P.StreetName, P.StreetNumber
> ======================================================
> madExcept said this (some of which might be useful!) and more :-
>
> DBISAM Version : 3.30
> Session.RemoteAddress: 127.0.0.1
> Session.Host: localhost
> Remote.Type: rtLAN
> Session.Type: stLocal
>
> date/time : 2006-06-20, 15:04:55, 250ms
> computer name : ASL3
> user name : Jeff Cook <admin>
> operating system : Windows XP Service Pack 2 build 2600
> system language : English
> system up time : 21 hours 51 minutes
> program up time : 28 seconds
> processor : Intel(R) Pentium(R) 4 CPU 2.40GHz
> physical memory : 38/479 MB (free/total)
> free disk space : (CSmile9.08 GB
> display mode : 1024x768, 32 bit
> process id : $7f0
> allocated memory : 13.52 MB
> executable : apm.exe
> exec. date/time : 2006-06-20 15:03
> version : 3.9.10.6
> madExcept version : 3.0a
> contact name : Jeff
> contact email : jeffc@aspect.co.nz
> callstack crc : $c0142c86, $9bc3bcbd, $9bc3bcbd
> exception number : 1
> exception class : EAccessViolation
> exception message : Access violation at address 0054A38C in module
> 'apm.exe'. Read of address 00000004.
>
> main thread ($f4c):
> 0054a38c +000 apm.exe dbisamen TDataCursor.CheckForChangeDetection
> 0055f21d +021 apm.exe dbisamen TDataCursor.ResetFilter
> 004fa14e +03e apm.exe dbisamsq TDataQuery.BuildSubSelectFilter
> 00561589 +035 apm.exe dbisamen TDataCursor.EvaluateFilterForRecord
> 00561456 +07e apm.exe dbisamen TDataCursor.NavigateNonIndexedRecords
> 005476cc +034 apm.exe dbisamen TFilter.BuildNonIndexedBitmap
> 00546933 +a3f apm.exe dbisamen TFilter.EvaluateFilter
> 00545e21 +021 apm.exe dbisamen TFilter.Update
> 00560b0f +19b apm.exe dbisamen TDataCursor.UpdateAllFilters
> 005569d3 +017 apm.exe dbisamen TDataCursor.RefreshRangeAndFilters
> 0054a36e +026 apm.exe dbisamen TDataCursor.CheckForCursorChanges
> 0054a3a1 +015 apm.exe dbisamen TDataCursor.CheckForChangeDetection
> 0055ef86 +156 apm.exe dbisamen TDataCursor.DropFilter
> 004eb449 +011 apm.exe dbisamsq TJoin.FreeJoinFilterHandle
> 004eaf81 +00d apm.exe dbisamsq TJoin.Destroy
> 004042f4 +008 apm.exe System TObject.Free
> 004eb98c +020 apm.exe dbisamsq TSourceTable.FreeJoins
> 004edd83 +023 apm.exe dbisamsq TDataQuery.FreeSourceTables
> 004edadc +018 apm.exe dbisamsq TDataQuery.Destroy
> 004042f4 +008 apm.exe System TObject.Free
> 004ed2aa +01a apm.exe dbisamsq TQueryStatement.FreeDataQueries
> 004ec6c2 +096 apm.exe dbisamsq TQueryStatement.Destroy
> 004042f4 +008 apm.exe System TObject.Free
> 0058476d +00d apm.exe DBISAMTb TDBISAMQuery.FreeStatement
> 0058472a +086 apm.exe DBISAMTb TDBISAMQuery.SetPrepared
> 00584dfc +050 apm.exe DBISAMTb TDBISAMQuery.SetDBFlag
> 005804ba +012 apm.exe DBISAMTb TDBISAMDBDataSet.CloseCursor
> 004e10c7 +0a7 apm.exe DB TDataSet.SetActive
> 004e0ecc +004 apm.exe DB TDataSet.Close
> 007e060b +043 apm.exe RptA29UnusedPropertiesList 100 +3
> TUnusedProperties.ActivateQuery
> 007e0e45 +1a5 apm.exe RptA29UnusedPropertiesList 249 +33
> TUnusedProperties.btnDeleteSelectedClick
> 0049f89c +064 apm.exe Controls TControl.Click
> 0048bce8 +01c apm.exe StdCtrls TButton.Click
> 004c5a49 +065 apm.exe Buttons TBitBtn.Click
> 0048bddc +00c apm.exe StdCtrls TButton.CNCommand
> 0049f704 +188 apm.exe Controls TControl.WndProc
> 004a272f +157 apm.exe Controls TWinControl.WndProc
> 0048bc5c +06c apm.exe StdCtrls TButtonControl.WndProc
> 0049f4d4 +024 apm.exe Controls TControl.Perform
> 004a2867 +023 apm.exe Controls DoControlMsg
> 004a2ec3 +00b apm.exe Controls TWinControl.WMCommand
> 0049f704 +188 apm.exe Controls TControl.WndProc
> 004a272f +157 apm.exe Controls TWinControl.WndProc
> 004a23ac +02c apm.exe Controls TWinControl.MainWndProc
> 004746c0 +014 apm.exe Classes StdWndProc
> 77d4b8fe +044 user32.dll SendMessageW
> 77d4e900 +016 user32.dll CallWindowProcA
> 004a2813 +0d7 apm.exe Controls TWinControl.DefaultHandler
> 0049fca4 +010 apm.exe Controls TControl.WMLButtonUp
> 0049f704 +188 apm.exe Controls TControl.WndProc
> 004a272f +157 apm.exe Controls TWinControl.WndProc
> 0048bc5c +06c apm.exe StdCtrls TButtonControl.WndProc
> 004a23ac +02c apm.exe Controls TWinControl.MainWndProc
> 004746c0 +014 apm.exe Classes StdWndProc
> 77d496c2 +00a user32.dll DispatchMessageA
> 004bf797 +083 apm.exe Forms TApplication.ProcessMessage
> 004bf7ce +00a apm.exe Forms TApplication.HandleMessage
> 004bc633 +147 apm.exe Forms TCustomForm.ShowModal
> 008a46ee +052 apm.exe apmMain 4650 +5
> TmainForm.menuAdminUnusedPropertiesClick
> 004b05fe +0a6 apm.exe Menus TMenuItem.Click
> 004b17d7 +013 apm.exe Menus TMenu.DispatchCommand
> 004bb103 +01f apm.exe Forms TCustomForm.WMCommand
> 0049f704 +188 apm.exe Controls TControl.WndProc
> 004a272f +157 apm.exe Controls TWinControl.WndProc
> 004b9235 +421 apm.exe Forms TCustomForm.WndProc
> 004c180f +09b apm.exe JvWndProcHook TJvHookInfos.WindowProc
> 004a23ac +02c apm.exe Controls TWinControl.MainWndProc
> 004746c0 +014 apm.exe Classes StdWndProc
> 77d496c2 +00a user32.dll DispatchMessageA
> 004bf797 +083 apm.exe Forms TApplication.ProcessMessage
> 004bf7ce +00a apm.exe Forms TApplication.HandleMessage
> 004bf9ee +096 apm.exe Forms TApplication.Run
> 008a95de +0ba apm.exe apm 279 +12 initialization
>
> thread $6ac (TIdIPWatchThread):
> 7c90eb94 +00 ntdll.dll KiFastSystemCallRet
> 7c90d85a +0a ntdll.dll NtDelayExecution
> 7c8023e7 +4b kernel32.dll SleepEx
> 7c80244c +0a kernel32.dll Sleep
> 0088edb2 +26 apm.exe IdIPWatch TIdIPWatchThread.Run
> 0088e4fd +5d apm.exe IdThread TIdThread.Execute
> 0044e367 +2b apm.exe madExcept HookedTThreadExecute
> 00472b88 +34 apm.exe Classes ThreadProc
> 00405160 +28 apm.exe System ThreadWrapper
> 0044e271 +0d apm.exe madExcept CallThreadProc
> 0044e2b3 +37 apm.exe madExcept ThreadExceptFrame
>>> created by main thread ($f4c) at:
> 0088e5bb +1f apm.exe IdThread TIdThread.Create
>
> thread $704:
> 7c90eb94 +00 ntdll.dll KiFastSystemCallRet
> 7c90e397 +0a ntdll.dll NtReplyWaitReceivePortEx
> 0044e271 +0d apm.exe madExcept CallThreadProc
> 0044e2b3 +37 apm.exe madExcept ThreadExceptFrame
>>> created by main thread ($f4c) at:
> 77e8760d +00 rpcrt4.dll
>
> thread $d44:
> 7c90eb94 +00 ntdll.dll KiFastSystemCallRet
> 7c90d85a +0a ntdll.dll NtDelayExecution
> 7c8023e7 +4b kernel32.dll SleepEx
> 7c80244c +0a kernel32.dll Sleep
> 0044e271 +0d apm.exe madExcept CallThreadProc
> 0044e2b3 +37 apm.exe madExcept ThreadExceptFrame
>>> created by main thread ($f4c) at:
> 7750cc4a +00 ole32.dll
>
> stack dump:
> 0013ea6c 22 f2 55 00 b0 df b8 02 - 1c a1 cb 02 b0 df b8 02
> ".U............. 0013ea7c 00 00 00 00 4b 1e 00 00 - 01 00 00 00 a8 f5 50
> 00 ....K.........P. 0013ea8c de 51 51 00 dc df ba 02 - 40 2f 51 00 e5 3d
> 51 00 .QQ.....@/Q..=Q. 0013ea9c ed 3d 51 00 18 9c ba 02 - c3 23 40 00 c8
> b5 8b 00 .=Q......#@..... 0013eaac 3a 4c 40 00 42 23 40 00 - 14 eb 13 00
> c4 23 40 00 :L@.B#@......#@. 0013eabc d4 ea 13 00 b0 df b8 02 - a0 4f cb
> 02 00 01 00 00 .........O...... 0013eacc 10 2f cb 02 5c 13 cb 02 - fc ea
> 13 00 1b 28 40 00 ./..\........(@. 0013eadc b0 df b8 02 80 36 45 00 - a0
> 4f cb 02 00 01 00 00 .....6E..O...... 0013eaec 70 60 51 00 2c eb 13 00 -
> b0 df b8 02 17 00 00 00 p`Q.,........... 0013eafc c0 4d 2f 01 a4 9f 46
> 00 - 50 eb 13 00 b0 df b8 02 .M/...F.P....... 0013eb0c 50 eb 13 00 b0 df
> b8 02 - b0 df b8 02 a0 97 c9 02 P............... 0013eb1c 50 eb 13 00 b0
> df b8 02 - 9c 4f cb 02 a0 97 c9 02 P........O...... 0013eb2c 45 9f 46 00
> ac b8 c9 02 - dc a1 4f 00 b0 df b8 02 E.F.......O..... 0013eb3c 84 20 cb
> 02 1c a1 cb 02 - 00 24 cb 02 b0 df b8 02 .........$...... 0013eb4c b0 df
> b8 02 7c eb 13 00 - ab a2 4f 00 00 00 50 00 ....|.....O...P. 0013eb5c 00
> 00 50 00 64 3f 50 00 - b0 df b8 02 1c a1 cb 02 ..P.d?P......... 0013eb6c
> b0 df b8 02 00 00 00 00 - b0 df b8 02 b0 df b8 02 ................
> 0013eb7c 28 ed 13 00 84 20 cb 02 - 00 00 00 00 28 ed 13 00
> (...........(... 0013eb8c 53 a1 4f 00 b0 18 cb 02 - 1c a1 cb 02 97 8c 52
> 00 S.O...........R. 0013eb9c 68 ed 13 00 b0 4a 40 00 - 28 ed 13 00 b0 18
> cb 02 h....J@.(.......
>
> disassembling:
> [...]
> 007e05f7 push $7e06ac ; System.@HandleFinally
> 007e05fc push dword ptr fs:[eax]
> 007e05ff mov fs:[eax], esp
> 007e0602 100 mov eax, [ebp-4]
> 007e0605 mov eax, [eax+$380]
> 007e060b > call -$2ff748 ($4e0ec8) ; DB.TDataSet.Close
> 007e0610 101 mov eax, [ebp-4]
> 007e0613 mov eax, [eax+$460]
> 007e0619 mov eax, [eax+$208]
> 007e061f xor edx, edx
> 007e0621 call -$2312f6 ($5af330) ; ComCtrls.TStatusPanels.GetItem
> [...]
>
>
>
>
>
> --
> Jeff Cook
> Aspect Systems Ltd
> Phone: +64-9-424 5388
> Skype: jeffcooknz
> www.aspect.co.nz
>
>
>
>
>

Tue, Jun 20 2006 12:29 AMPermanent Link

Jeff Cook
"Steve Forbes" <ozmosys@spamfreeoptusnet.com.au> wrote on Tue, 20 Jun 2006 14:07:11 +1000

>Hi Jeff,
>
>You don't have an event hooked into the query or attached dataset that is
>trying to fire against the closed dataset do you?
>
>--
>

Hi Steve,

No events on the datasets at all.  Surprisingly, I had actually thought of that one and have just checked it again.  The operation of the module is what I have pasted below.

Still head scratching.

Thanks
Jeff

============================================================================================
procedure TUnusedProperties.btnDeleteSelectedClick(Sender: TObject);
var
 iCount: integer;
 procedure StatusMessage1(Text: string);
 begin
   StatusBar1.Panels[0].Text := Format('Processing %d of %d properties - %s',
     [qryProperties.RecNo, iCount, Text]);
   Application.ProcessMessages;
 end;
begin
 inherited;
 Common.LogEvent('Start deleting unused Properties');
 with qryProperties do
 begin
   Screen.Cursor := crSQLWait;
   pnlButton.Enabled := False;
   try
     First;
     iCount := RecordCount;
     while not EOF  and (RecNo < 6) {*****  testing *************} do
     begin
       if qryPropertiesSelected.AsBoolean then
       begin
         with qryDeleteProperties do
         begin
           ParamByName('PropertyCode').AsString := qryPropertiesPropertyCode.AsString;
           StatusMessage1('Deleting Property');
           if not Prepared then Prepare;
           ExecSQL;
         end;
         StatusMessage1('Deleting Photos');
         apmDM.DeletePhotos('', qryPropertiesPropertyCode.AsString);  // this is non-DBISAM - deleting jpg files.
       end;
       Next;
     end;
   finally
     qryDeleteProperties.UnPrepare;
     Screen.Cursor := crDefault;
     pnlButton.Enabled := True;
   end;
 end;
 Common.LogEvent('Finish deleting unused Properties');
 ActivateQuery;
end;
=========================================
qryDeleteProperties is just this:-

DELETE FROM Properties
WHERE PropertyCode = :PropertyCode
==========================================
--
Jeff Cook
Aspect Systems Ltd
Phone: +64-9-424 5388
Skype: jeffcooknz
www.aspect.co.nz



Tue, Jun 20 2006 3:06 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Jeff


Really silly question but I presume you've checked to make sure qryProperties still exists at that point?

Roy Lambert
Tue, Jun 20 2006 5:19 AMPermanent Link

"Clive"
Is your app multi-threaded ?

"Jeff Cook" <jeffc@aspect.co.nz> wrote in message
news:070694F9-199D-4ECD-9BDE-B807B2E31130@news.elevatesoft.com...
> Hi
>
> I've got a really odd situation where I get an AV on closing a query.
>
> I open this query at the start of the module with the "ActivateQuery"
> procedure below. I then use the resulting dataset in a grid and use it to
> step through deleting records from a table. At the end of this batch
> deletion I attempt to reopen query with the "ActivateQuery" procedure, but
> get an AV.
>
> I have very similar code operating on different tables and that works OK,
> it is just this module and I can't see why a Close would cause an AV.
>
> Any help appreciated!
>
> Cheers
>
> Jeff
> =======================================================
> procedure TUnusedProperties.ActivateQuery;
> begin
> Screen.Cursor := crSQLWait;
> try
> qryProperties.Close; // <<<<<<<<<< AV here!
> StatusBar1.Panels[0].Text := 'Checking Properties';
> Application.ProcessMessages;
> qryProperties.Open;
> StatusBar1.Panels[0].Text := IntToStr(qryProperties.RecordCount)
> + ' Properties found';
> finally
> Screen.Cursor := crDefault;
> end;
> btnPrint.SetFocus;
> end;
> =====================================================
> The SQL is unremarkable:-
>
> SELECT P.StreetNumber, P.StreetName, P.Suburb, P.PropertyCode,
> IF(P.Managed THEN "Yes" ELSE "No") AS Managed,
> L.LandlordCode, L.SortKey, True AS Selected
> FROM Properties P
> JOIN Landlords L ON (L.LandlordCode = P.LandlordCode)
> WHERE P.PropertyCode NOT IN (SELECT DISTINCT PropertyCode FROM Tenants)
> ORDER BY P.StreetName, P.StreetNumber
> ======================================================
> madExcept said this (some of which might be useful!) and more :-
>
> DBISAM Version : 3.30
> Session.RemoteAddress: 127.0.0.1
> Session.Host: localhost
> Remote.Type: rtLAN
> Session.Type: stLocal
>
> date/time : 2006-06-20, 15:04:55, 250ms
> computer name : ASL3
> user name : Jeff Cook <admin>
> operating system : Windows XP Service Pack 2 build 2600
> system language : English
> system up time : 21 hours 51 minutes
> program up time : 28 seconds
> processor : Intel(R) Pentium(R) 4 CPU 2.40GHz
> physical memory : 38/479 MB (free/total)
> free disk space : (CSmile9.08 GB
> display mode : 1024x768, 32 bit
> process id : $7f0
> allocated memory : 13.52 MB
> executable : apm.exe
> exec. date/time : 2006-06-20 15:03
> version : 3.9.10.6
> madExcept version : 3.0a
> contact name : Jeff
> contact email : jeffc@aspect.co.nz
> callstack crc : $c0142c86, $9bc3bcbd, $9bc3bcbd
> exception number : 1
> exception class : EAccessViolation
> exception message : Access violation at address 0054A38C in module
> 'apm.exe'. Read of address 00000004.
>
> main thread ($f4c):
> 0054a38c +000 apm.exe dbisamen TDataCursor.CheckForChangeDetection
> 0055f21d +021 apm.exe dbisamen TDataCursor.ResetFilter
> 004fa14e +03e apm.exe dbisamsq TDataQuery.BuildSubSelectFilter
> 00561589 +035 apm.exe dbisamen TDataCursor.EvaluateFilterForRecord
> 00561456 +07e apm.exe dbisamen TDataCursor.NavigateNonIndexedRecords
> 005476cc +034 apm.exe dbisamen TFilter.BuildNonIndexedBitmap
> 00546933 +a3f apm.exe dbisamen TFilter.EvaluateFilter
> 00545e21 +021 apm.exe dbisamen TFilter.Update
> 00560b0f +19b apm.exe dbisamen TDataCursor.UpdateAllFilters
> 005569d3 +017 apm.exe dbisamen TDataCursor.RefreshRangeAndFilters
> 0054a36e +026 apm.exe dbisamen TDataCursor.CheckForCursorChanges
> 0054a3a1 +015 apm.exe dbisamen TDataCursor.CheckForChangeDetection
> 0055ef86 +156 apm.exe dbisamen TDataCursor.DropFilter
> 004eb449 +011 apm.exe dbisamsq TJoin.FreeJoinFilterHandle
> 004eaf81 +00d apm.exe dbisamsq TJoin.Destroy
> 004042f4 +008 apm.exe System TObject.Free
> 004eb98c +020 apm.exe dbisamsq TSourceTable.FreeJoins
> 004edd83 +023 apm.exe dbisamsq TDataQuery.FreeSourceTables
> 004edadc +018 apm.exe dbisamsq TDataQuery.Destroy
> 004042f4 +008 apm.exe System TObject.Free
> 004ed2aa +01a apm.exe dbisamsq TQueryStatement.FreeDataQueries
> 004ec6c2 +096 apm.exe dbisamsq TQueryStatement.Destroy
> 004042f4 +008 apm.exe System TObject.Free
> 0058476d +00d apm.exe DBISAMTb TDBISAMQuery.FreeStatement
> 0058472a +086 apm.exe DBISAMTb TDBISAMQuery.SetPrepared
> 00584dfc +050 apm.exe DBISAMTb TDBISAMQuery.SetDBFlag
> 005804ba +012 apm.exe DBISAMTb TDBISAMDBDataSet.CloseCursor
> 004e10c7 +0a7 apm.exe DB TDataSet.SetActive
> 004e0ecc +004 apm.exe DB TDataSet.Close
> 007e060b +043 apm.exe RptA29UnusedPropertiesList 100 +3
> TUnusedProperties.ActivateQuery
> 007e0e45 +1a5 apm.exe RptA29UnusedPropertiesList 249 +33
> TUnusedProperties.btnDeleteSelectedClick
> 0049f89c +064 apm.exe Controls TControl.Click
> 0048bce8 +01c apm.exe StdCtrls TButton.Click
> 004c5a49 +065 apm.exe Buttons TBitBtn.Click
> 0048bddc +00c apm.exe StdCtrls TButton.CNCommand
> 0049f704 +188 apm.exe Controls TControl.WndProc
> 004a272f +157 apm.exe Controls TWinControl.WndProc
> 0048bc5c +06c apm.exe StdCtrls TButtonControl.WndProc
> 0049f4d4 +024 apm.exe Controls TControl.Perform
> 004a2867 +023 apm.exe Controls DoControlMsg
> 004a2ec3 +00b apm.exe Controls TWinControl.WMCommand
> 0049f704 +188 apm.exe Controls TControl.WndProc
> 004a272f +157 apm.exe Controls TWinControl.WndProc
> 004a23ac +02c apm.exe Controls TWinControl.MainWndProc
> 004746c0 +014 apm.exe Classes StdWndProc
> 77d4b8fe +044 user32.dll SendMessageW
> 77d4e900 +016 user32.dll CallWindowProcA
> 004a2813 +0d7 apm.exe Controls TWinControl.DefaultHandler
> 0049fca4 +010 apm.exe Controls TControl.WMLButtonUp
> 0049f704 +188 apm.exe Controls TControl.WndProc
> 004a272f +157 apm.exe Controls TWinControl.WndProc
> 0048bc5c +06c apm.exe StdCtrls TButtonControl.WndProc
> 004a23ac +02c apm.exe Controls TWinControl.MainWndProc
> 004746c0 +014 apm.exe Classes StdWndProc
> 77d496c2 +00a user32.dll DispatchMessageA
> 004bf797 +083 apm.exe Forms TApplication.ProcessMessage
> 004bf7ce +00a apm.exe Forms TApplication.HandleMessage
> 004bc633 +147 apm.exe Forms TCustomForm.ShowModal
> 008a46ee +052 apm.exe apmMain 4650 +5
> TmainForm.menuAdminUnusedPropertiesClick
> 004b05fe +0a6 apm.exe Menus TMenuItem.Click
> 004b17d7 +013 apm.exe Menus TMenu.DispatchCommand
> 004bb103 +01f apm.exe Forms TCustomForm.WMCommand
> 0049f704 +188 apm.exe Controls TControl.WndProc
> 004a272f +157 apm.exe Controls TWinControl.WndProc
> 004b9235 +421 apm.exe Forms TCustomForm.WndProc
> 004c180f +09b apm.exe JvWndProcHook TJvHookInfos.WindowProc
> 004a23ac +02c apm.exe Controls TWinControl.MainWndProc
> 004746c0 +014 apm.exe Classes StdWndProc
> 77d496c2 +00a user32.dll DispatchMessageA
> 004bf797 +083 apm.exe Forms TApplication.ProcessMessage
> 004bf7ce +00a apm.exe Forms TApplication.HandleMessage
> 004bf9ee +096 apm.exe Forms TApplication.Run
> 008a95de +0ba apm.exe apm 279 +12 initialization
>
> thread $6ac (TIdIPWatchThread):
> 7c90eb94 +00 ntdll.dll KiFastSystemCallRet
> 7c90d85a +0a ntdll.dll NtDelayExecution
> 7c8023e7 +4b kernel32.dll SleepEx
> 7c80244c +0a kernel32.dll Sleep
> 0088edb2 +26 apm.exe IdIPWatch TIdIPWatchThread.Run
> 0088e4fd +5d apm.exe IdThread TIdThread.Execute
> 0044e367 +2b apm.exe madExcept HookedTThreadExecute
> 00472b88 +34 apm.exe Classes ThreadProc
> 00405160 +28 apm.exe System ThreadWrapper
> 0044e271 +0d apm.exe madExcept CallThreadProc
> 0044e2b3 +37 apm.exe madExcept ThreadExceptFrame
>>> created by main thread ($f4c) at:
> 0088e5bb +1f apm.exe IdThread TIdThread.Create
>
> thread $704:
> 7c90eb94 +00 ntdll.dll KiFastSystemCallRet
> 7c90e397 +0a ntdll.dll NtReplyWaitReceivePortEx
> 0044e271 +0d apm.exe madExcept CallThreadProc
> 0044e2b3 +37 apm.exe madExcept ThreadExceptFrame
>>> created by main thread ($f4c) at:
> 77e8760d +00 rpcrt4.dll
>
> thread $d44:
> 7c90eb94 +00 ntdll.dll KiFastSystemCallRet
> 7c90d85a +0a ntdll.dll NtDelayExecution
> 7c8023e7 +4b kernel32.dll SleepEx
> 7c80244c +0a kernel32.dll Sleep
> 0044e271 +0d apm.exe madExcept CallThreadProc
> 0044e2b3 +37 apm.exe madExcept ThreadExceptFrame
>>> created by main thread ($f4c) at:
> 7750cc4a +00 ole32.dll
>
> stack dump:
> 0013ea6c 22 f2 55 00 b0 df b8 02 - 1c a1 cb 02 b0 df b8 02
> ".U............. 0013ea7c 00 00 00 00 4b 1e 00 00 - 01 00 00 00 a8 f5 50
> 00 ....K.........P. 0013ea8c de 51 51 00 dc df ba 02 - 40 2f 51 00 e5 3d
> 51 00 .QQ.....@/Q..=Q. 0013ea9c ed 3d 51 00 18 9c ba 02 - c3 23 40 00 c8
> b5 8b 00 .=Q......#@..... 0013eaac 3a 4c 40 00 42 23 40 00 - 14 eb 13 00
> c4 23 40 00 :L@.B#@......#@. 0013eabc d4 ea 13 00 b0 df b8 02 - a0 4f cb
> 02 00 01 00 00 .........O...... 0013eacc 10 2f cb 02 5c 13 cb 02 - fc ea
> 13 00 1b 28 40 00 ./..\........(@. 0013eadc b0 df b8 02 80 36 45 00 - a0
> 4f cb 02 00 01 00 00 .....6E..O...... 0013eaec 70 60 51 00 2c eb 13 00 -
> b0 df b8 02 17 00 00 00 p`Q.,........... 0013eafc c0 4d 2f 01 a4 9f 46
> 00 - 50 eb 13 00 b0 df b8 02 .M/...F.P....... 0013eb0c 50 eb 13 00 b0 df
> b8 02 - b0 df b8 02 a0 97 c9 02 P............... 0013eb1c 50 eb 13 00 b0
> df b8 02 - 9c 4f cb 02 a0 97 c9 02 P........O...... 0013eb2c 45 9f 46 00
> ac b8 c9 02 - dc a1 4f 00 b0 df b8 02 E.F.......O..... 0013eb3c 84 20 cb
> 02 1c a1 cb 02 - 00 24 cb 02 b0 df b8 02 .........$...... 0013eb4c b0 df
> b8 02 7c eb 13 00 - ab a2 4f 00 00 00 50 00 ....|.....O...P. 0013eb5c 00
> 00 50 00 64 3f 50 00 - b0 df b8 02 1c a1 cb 02 ..P.d?P......... 0013eb6c
> b0 df b8 02 00 00 00 00 - b0 df b8 02 b0 df b8 02 ................
> 0013eb7c 28 ed 13 00 84 20 cb 02 - 00 00 00 00 28 ed 13 00
> (...........(... 0013eb8c 53 a1 4f 00 b0 18 cb 02 - 1c a1 cb 02 97 8c 52
> 00 S.O...........R. 0013eb9c 68 ed 13 00 b0 4a 40 00 - 28 ed 13 00 b0 18
> cb 02 h....J@.(.......
>
> disassembling:
> [...]
> 007e05f7 push $7e06ac ; System.@HandleFinally
> 007e05fc push dword ptr fs:[eax]
> 007e05ff mov fs:[eax], esp
> 007e0602 100 mov eax, [ebp-4]
> 007e0605 mov eax, [eax+$380]
> 007e060b > call -$2ff748 ($4e0ec8) ; DB.TDataSet.Close
> 007e0610 101 mov eax, [ebp-4]
> 007e0613 mov eax, [eax+$460]
> 007e0619 mov eax, [eax+$208]
> 007e061f xor edx, edx
> 007e0621 call -$2312f6 ($5af330) ; ComCtrls.TStatusPanels.GetItem
> [...]
>
>
>
>
>
> --
> Jeff Cook
> Aspect Systems Ltd
> Phone: +64-9-424 5388
> Skype: jeffcooknz
> www.aspect.co.nz
>
>
>
>

Tue, Jun 20 2006 5:46 AMPermanent Link

Jeff Cook
Roy Lambert <roy.lambert@skynet.co.uk> wrote on Tue, 20 Jun 2006 08:03:51 +0100

>Jeff
>
>
>Really silly question but I presume you've checked to make sure qryProperties still exists at that point?
>
>Roy Lambert
>
Roy


There are no silly questions ... just silly answers Wink

If I comment out the .Close, then the code runs through OK - of course this means that the .Open does nothing and the query isn't refreshed - but it does run.

Thanks

Jeff

--
Jeff Cook
Aspect Systems Ltd
Phone: +64-9-424 5388
Skype: jeffcooknz
www.aspect.co.nz



Tue, Jun 20 2006 5:50 AMPermanent Link

Jeff Cook
"Clive" <dd@dddd.com> wrote on Tue, 20 Jun 2006 21:17:15 +1200

>Is your app multi-threaded ?
>
Clive


No, though madExcept seems to generate it's own threads if I'm reading the error report correctly.  I have tried turning off madExcept too, but still get the AV.

Thanks

Jeff
--
Jeff Cook
Aspect Systems Ltd
Phone: +64-9-424 5388
Skype: jeffcooknz
www.aspect.co.nz



Tue, Jun 20 2006 5:52 AMPermanent Link

"Robert"

"Jeff Cook" <jeffc@aspect.co.nz> wrote in message
news:070694F9-199D-4ECD-9BDE-B807B2E31130@news.elevatesoft.com...
> Hi
>
> I've got a really odd situation where I get an AV on closing a query.
>
> I open this query at the start of the module with the "ActivateQuery"
> procedure below. I then use the resulting dataset in a grid and use it to
> step through deleting records from a table.

1. Does it work if you delete all but one of the records?
2. Do you have a transaction active?

Robert

Tue, Jun 20 2006 2:32 PMPermanent Link

Jeff Cook
"Robert" <ngsemail2005withoutthis@yahoo.com.ar> wrote on Tue, 20 Jun 2006 05:49:39 -0400

Robert

>1. Does it work if you delete all but one of the records?

No - same problem.

>2. Do you have a transaction active?

No - no explicit transaction - just the ones generated by the delete query - which is unprepared at the end of the procedure.


Thanks, Robert


Cheers

Jeff

--
Jeff Cook
Aspect Systems Ltd
Phone: +64-9-424 5388
Skype: jeffcooknz
www.aspect.co.nz



Tue, Jun 20 2006 3:59 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jeff,

<< I open this query at the start of the module with the "ActivateQuery"
procedure below. I then use the resulting dataset in a grid and use it to
step through deleting records from a table. At the end of this batch
deletion I attempt to reopen query with the "ActivateQuery" procedure, but
get an AV. >>

It sounds like you're running into this issue:

http://www.elevatesoft.com/scripts/incident.dll?action=viewrep&release=4.14&type=f&incident=1909

or something similar.  The workaround is to use a canned result set instead
of a live result set.

--
Tim Young
Elevate Software
www.elevatesoft.com

Page 1 of 2Next Page »
Jump to Page:  1 2
Image