Page 3 of 5

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Mon Aug 10, 2009 5:29 pm
by James Bott
Enrico,

Apparently not, since it is an intermitant problem. Rick says it is only happening on two computers.

In summary the issue is that the browse cannot be closed until the window is closed, and the recordset needs to be closed before the window. Under some circumstances if you close the recordset right before the window is closed, then the browse does a redisplay and the program crashes.

James

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Mon Aug 10, 2009 5:34 pm
by James Bott
Rao,

Rick is using version 9.04, not 9.06. I expect the same code would still work wouldn't it?

James

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Mon Aug 10, 2009 5:49 pm
by nageswaragunupudi
James Bott wrote:Rao,

Rick is using version 9.04, not 9.06. I expect the same code would still work wouldn't it?

James

Should work.
Major change from 9.05 is all the code in End() method was moved to Destroy() method. In other words, if End() was not called in the program, resources were not getting released.

But it has nothing to do with the code I sent. It still works.

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Mon Aug 10, 2009 6:46 pm
by Rick Lipkin
To All

Got my dreaded error again .. I have set up an appointment to visit this user and see what in the world is going on here .. restored the default xbrowse setado and oBrw := NIL

Rick

Code: Select all  Expand view

Application
===========
   Path and name: J:\VEHICLE\Veh32.Exe (32 bits)
   Size:   969,728 bytes
   Time from start: 0 hours 20 mins 40 secs
   Error occurred at: 08/10/2009, 14:16:06
   Error description: Error ADODB.Recordset/6  DISP_E_UNKNOWNNAME: RECORDCOUNT
   Args:

Stack Calls
===========
   Called from: source\rtl\win32ole.prg => TOLEAUTO:RECORDCOUNT(0)
   Called from: xbrowse.prg => (b)TXBROWSE:SETADO(3750)
   Called from: xbrowse.prg => TXBROWSE:PAINT(1254)
   Called from: xbrowse.prg => TXBROWSE:DISPLAY(957)
   Called from: .\source\classes\CONTROL.PRG => TXBROWSE:HANDLEEVENT(1423)
   Called from: .\source\classes\WINDOW.PRG => _FWH(3333)
   Called from:  => DIALOGBOXINDIRECT(0)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
   Called from: .\source\function\ERRSYSW.PRG => ERRORDIALOG(343)
   Called from: .\source\function\ERRSYSW.PRG => (b)ERRORSYS(27)
   Called from: source\rtl\win32ole.prg => TOLEAUTO:RECORDCOUNT(0)
   Called from: xbrowse.prg => (b)TXBROWSE:SETADO(3750)
   Called from: xbrowse.prg => TXBROWSE:PAINT(1254)
   Called from: xbrowse.prg => TXBROWSE:DISPLAY(957)
   Called from: .\source\classes\CONTROL.PRG => TXBROWSE:HANDLEEVENT(1423)
   Called from: .\source\classes\WINDOW.PRG => _FWH(3333)
   Called from:  => WINRUN(0)
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE(952)
   Called from: MAIN.PRG => MAIN(381)

System
======
   CPU type: AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ 2600 Mhz
   Hardware memory: 2047 megs

   Free System resources: 90 %
        GDI    resources: 90 %
        User   resources: 90 %

   Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 6406)
   Windows version: 5.1, Build 2600 Service Pack 2


 

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Mon Aug 10, 2009 9:05 pm
by Enrico Maria Giordano
James Bott wrote:Enrico,

Apparently not, since it is an intermitant problem. Rick says it is only happening on two computers.

In summary the issue is that the browse cannot be closed until the window is closed, and the recordset needs to be closed before the window. Under some circumstances if you close the recordset right before the window is closed, then the browse does a redisplay and the program crashes.

James


A control can be released using the End() method. But without a sample of the problem how can I test a possible solution?

EMG

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Mon Aug 10, 2009 10:21 pm
by James Bott
Enrico,

>A control can be released using the End() method.

Contrary to popular belief, this is not always true. Did you read all this thread? You can do an oBrw:End() and the browse continues to exist and work. See my sample code in a previous post showing how to test this. So, even after you do an oBrw:End() the browse can do a Display() and then it crashes because the recordset has been destroyed.

>But without a sample of the problem how can I test a possible solution?

You can't. For now, only Rick can test it on his two PCs.

James

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Wed Aug 12, 2009 8:51 am
by Enrico Maria Giordano
Please try this modified version of your test and you will see that oBrw:End() effectively destroys the browse:

Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"

function Main()

   local oWnd, oBrw

   DEFINE Window oWnd

   define buttonbar oBar of oWnd
   define button of oBar action oBrw:End()

   @ 0, 0 XBROWSE oBrw OF oWnd ARRAY { { "one","two","three" } } AUTOCOLS

   oBrw:CreateFromCode()

   oWnd:oClient:= oBrw

   activate window oWnd


return nil


EMG

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Wed Aug 12, 2009 1:49 pm
by Rick Lipkin
Enrico

Using 9.06 the sample closed the listbox but not the window ..

[img]
http://img228.imageshack.us/img228/4767/brow1.jpg
[/img]

[img]
http://img266.imageshack.us/img266/7198/brow2.jpg
[/img]

oBrw:End() closes the listbox but leaves the Window open and subject to 'paint' and if you close your database or recordset with a valid close under certain circumstances .. ( unknown as of yet ) the Windows paint trigger fires and that is where we end up with a problem .. the data or record set is closed and destroyed and when the window tries to re-paint .. the window object still sees the connection to the listbox and or recordset .. and I think this is the run-time I am experiencing ..

I am still trying to determine under what circumstances cause the intermittant xbrowse code blocks to fire
.. that is where I am at the moment.

Rick

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Wed Aug 12, 2009 2:01 pm
by Enrico Maria Giordano
Rick Lipkin wrote:Enrico

Using 9.06 the sample closed the listbox but not the window ..


It's the expected behavior. oCtl:End() only destroys oCtl control. oWnd:End() closes the window.

Rick Lipkin wrote:oBrw:End() closes the listbox but leaves the Window open and subject to 'paint'


Can you replicate this behavior (browse destroyed, window still sending messages to the destroyed browse) in a small sample?

EMG

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Wed Aug 12, 2009 6:59 pm
by James Bott
Enrico,

>Please try this modified version of your test and you will see that oBrw:End() effectively destroys the browse:

Yes, you will see that it is destroyed, but in fact it is not. Try this line instead:

define button of oBar action (oBrw:End(), oBrw:display(), msgInfo(valtype(oBrw)) )

It does not error out when oBrw:display() is called, and oBrw is still an "O" type, thus not destroyed. So, even though it is not visible, it still exists and is functioning.

James

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Wed Aug 12, 2009 7:11 pm
by James Bott
Enrico,

OK, here is a working example that errors out.

James

Code: Select all  Expand view
#include "FiveWin.ch"
#include "xbrowse.ch"

function Main()

   local oWnd, oBrw, oBar, aArray := { { "one","two","three" } }

   DEFINE Window oWnd

   define buttonbar oBar of oWnd
   define button of oBar action (oBrw:End(), oBrw:setArray({}), ;
      oBrw:display(), msgInfo(valtype(oBrw)) )

   @ 0, 0 XBROWSE oBrw OF oWnd ARRAY aArray AUTOCOLS

   oBrw:CreateFromCode()

   oWnd:oClient:= oBrw

   activate window oWnd

return nil

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Wed Aug 12, 2009 7:46 pm
by Enrico Maria Giordano
James Bott wrote:Yes, you will see that it is destroyed, but in fact it is not. Try this line instead:

define button of oBar action (oBrw:End(), oBrw:display(), msgInfo(valtype(oBrw)) )

It does not error out when oBrw:display() is called, and oBrw is still an "O" type, thus not destroyed. So, even though it is not visible, it still exists and is functioning.


You are confusing two different levels. One is FWH level and the other is Windows API level. oBrw:End() destroys the Windows API level control from FWH level object but have no effect on the content of oBrw variable itself that is a FWH level object not a Windows API object. oBrw still exists and is an object after End() method but their Windows API handles are invalidated.

EMG

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Wed Aug 12, 2009 7:48 pm
by Enrico Maria Giordano
James Bott wrote:Enrico,

OK, here is a working example that errors out.


Sorry, it doesn't error out here. I click on the button and get O. No errors. What am I missing?

EMG

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Wed Aug 12, 2009 7:52 pm
by James Bott
Enrico,

Are you sure you ran the right test program? Here it errors out immediately after pressing the button. And you can see the Paint() method is being called just like the problem Rick is having.

Using FWH 9.05, running under XP Pro.

James

Code: Select all  Expand view
===========
   Path and name: C:\Documents and Settings\James\My Documents\Projects\Temp\Test05.exe (32 bits)
   Size: 1,773,056 bytes
   Time from start: 0 hours 0 mins 2 secs
   Error occurred at: 08/12/09, 12:51:10
   Error description: Error BASE/1132  Bound error: array access
   Args:
     [   1] = A   { ... }
     [   2] = N   0

Stack Calls
===========
   Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:TXBROWSE(423)
   Called from:  => TXBROWSE:COLATPOS(0)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:PAINT(1085)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DISPLAY(946)
   Called from: Test05.prg => (b)MAIN(11)
   ...

Re: Intermittant xBrowse ADO error ( again )

PostPosted: Wed Aug 12, 2009 8:31 pm
by Enrico Maria Giordano
James Bott wrote:Enrico,

Are you sure you ran the right test program?


Yes. Please read carefully my other reply.

EMG