xbrowse : sporadic error

xbrowse : sporadic error

Postby Demont Brecht » Sun Nov 06, 2011 10:33 am

Hello,

In a intensive used aplication i got sporadic (4 errors in 2 years) , at line 396 :

METHOD ColAtPos( nPos ) INLINE ::aCols[ ::aDisplay[ MinMax( If( nPos == nil, 1, nPos ), 1, Len( ::aDisplay ) ) ] ]

With :

#xtranslate MinMax( <xValue>, <nMin>, <nMax> ) => ;
Min( Max( <xValue>, <nMin> ), <nMax> )

The error indicates

Error description: Error BASE/1132 Bound error: array access
Args:
[ 1] = A { ... }
[ 2] = N 0

ColAtPos seems to be called with parameter 1. When Minmax returns 0 , it can only be declared as LEN(::aDisplay) == 0

I can simulate this error with hiding all the columns from the browse . It gives the same error , but the calllist is much longer.

I have no idea how ::aDisplay can become empty , for this browe ocol:hide() is not used at all

I note also that the error occurs always on the same computer ( network from +/- 10 computers) , so could it be a hardware problem ?

Frank
Demont Brecht
 
Posts: 55
Joined: Fri Jul 08, 2011 6:43 am

Re: xbrowse : sporadic error

Postby ukservice » Sun Nov 06, 2011 11:44 am

I do get it very often:

It is not a hardware problem.

It happens randomly when painting xBrowse.

Code: Select all  Expand view  RUN
 Error description: Error BASE/1132  Bound error: array access

   Args:
     [   1] = A   { ... }
     [   2] = N   0

Stack Calls
===========
   Called from: source\xbrowse.prg => (b)TXBROWSE(517)
   Called from: source\xbrowse.prg => TXBROWSE:COLATPOS(0)
   Called from: source\xbrowse.prg => (b)TXBROWSE(519)
   Called from: source\xbrowse.prg => TXBROWSE:SELECTEDCOL(0)
   Called from: source\xbrowse.prg => TXBROWSE:PAINT(1250)
   Called from: source\xbrowse.prg => TXBROWSE:DISPLAY(1228)
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1686)
   Called from: source\xbrowse.prg => TXBROWSE:HANDLEEVENT(11511)
   Called from: .\source\classes\WINDOW.PRG => _FWH(3443)
   Called from:  => DIALOGBOX(0)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(277)
 
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: xbrowse : sporadic error

Postby Antonio Linares » Sun Nov 06, 2011 2:27 pm

Demont,

Please try it this way:

METHOD ColAtPos( nPos ) INLINE ::aCols[ ::aDisplay[ MinMax( If( nPos == nil, 1, nPos ), 1, Max( Len( ::aDisplay ), 1 ) ) ] ]
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: xbrowse : sporadic error

Postby Demont Brecht » Sun Nov 06, 2011 4:17 pm

Antonio,

/*
METHOD ColAtPos( nPos ) INLINE ::aCols[ ::aDisplay[ MinMax( If( nPos == nil, 1, nPos ), 1, Max( Len( ::aDisplay ), 1 ) ) ] ]
*/

I don't believe it will solve the problem , the real problem is that for some reason ::aDisplay is empty. With this corection we have ::aDisplay[1] , it should also give a error.

The translate :

#xtranslate MinMax( <xValue>, <nMin>, <nMax> ) => Min( Max( <xValue>, <nMin> ), <nMax> )

doesn't work when for some reason nMax < nMin , the translate gives then nMax ( the lowest value from nmin,nmax)

#xtranslate MinMax( <xValue>, <nMin>, <nMax> ) => Min( Max( <xValue>, MIN(<nMin>,<nMax>) ), MAX(<nMin>,<nMax>) )

Should work !
Demont Brecht
 
Posts: 55
Joined: Fri Jul 08, 2011 6:43 am

Re: xbrowse : sporadic error

Postby nageswaragunupudi » Sun Nov 06, 2011 8:47 pm

I don't believe it will solve the problem , the real problem is that for some reason ::aDisplay is empty.

Yes.
This is the real reason.
One case was resolved recently. When HScroll bar is moved in a single column browse, this was happening. This was fixed.

We need to see under what other situations ::aDisplay is becoming empty. Any feedback on this is welcome.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xbrowse : sporadic error

Postby Demont Brecht » Mon Nov 07, 2011 7:50 am

With version 8.10 i got nearly the same callist.

I do not understand this callist . Simulating this error , we got the error when the dialog is build , but the list is longer , the first 7 items :
original error list :
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => (b)TXBROWSE:TXBROWSE(396)
Called from: => TXBROWSE:COLATPOS(0)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => TXBROWSE:PAINT(996)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => TXBROWSE:DISPLAY(922)
Called from: .\source\classes\CONTROL.PRG => TXBROWSE:HANDLEEVENT(0)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\window.prg => _FWH(3308)
Called from: => WINRUN(0)
Sumulating :
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => (b)TXBROWSE:TXBROWSE(396)
Called from: => TXBROWSE:COLATPOS(0)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => TXBROWSE:PAINT(996)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\xbrowse.prg => TXBROWSE:DISPLAY(922)
Called from: .\source\classes\CONTROL.PRG => TXBROWSE:HANDLEEVENT(0)
Called from: \MCLS\HENWIN8.10\fwh8.10\changed\ChangedSource\window.prg => _FWH(3308)
Called from: => CREATEDLG(0)
So the error doesn't occur when the dialog is build , maybe when the dialog becomes focus. In ACTIVATE DIALOG i have NOMODAL




ukservice wrote:I do get it very often:

It is not a hardware problem.

It happens randomly when painting xBrowse.

Code: Select all  Expand view  RUN
 Error description: Error BASE/1132  Bound error: array access

   Args:
     [   1] = A   { ... }
     [   2] = N   0

Stack Calls
===========
   Called from: source\xbrowse.prg => (b)TXBROWSE(517)
   Called from: source\xbrowse.prg => TXBROWSE:COLATPOS(0)
   Called from: source\xbrowse.prg => (b)TXBROWSE(519)
   Called from: source\xbrowse.prg => TXBROWSE:SELECTEDCOL(0)
   Called from: source\xbrowse.prg => TXBROWSE:PAINT(1250)
   Called from: source\xbrowse.prg => TXBROWSE:DISPLAY(1228)
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1686)
   Called from: source\xbrowse.prg => TXBROWSE:HANDLEEVENT(11511)
   Called from: .\source\classes\WINDOW.PRG => _FWH(3443)
   Called from:  => DIALOGBOX(0)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(277)
 
Demont Brecht
 
Posts: 55
Joined: Fri Jul 08, 2011 6:43 am

Re: xbrowse : sporadic error

Postby Demont Brecht » Mon Nov 07, 2011 8:32 am

See also mine previous post.

The program uses obrw:bGotfocus.

oBrw:bGotFocus := { ||TestHid(oBrw,oCol) , .......}

PROC TestHid(oBrw,oCol)
STATIC n := 0
IF n > 0 // prevent error when the dialog is created
FOR EACH oCol IN oBrw:aCols
oCol:Hide()
NEXT
END
n++
RETURN

I got exact the same error list as mine user

Frank


nageswaragunupudi wrote:
I don't believe it will solve the problem , the real problem is that for some reason ::aDisplay is empty.

Yes.
This is the real reason.
One case was resolved recently. When HScroll bar is moved in a single column browse, this was happening. This was fixed.

We need to see under what other situations ::aDisplay is becoming empty. Any feedback on this is welcome.
Demont Brecht
 
Posts: 55
Joined: Fri Jul 08, 2011 6:43 am

Re: xbrowse : sporadic error

Postby nageswaragunupudi » Mon Nov 07, 2011 8:59 am

#1. You should never hide all columns. Atleast one column should be visible.

#2. When there is only one column in the browse, using horizontal scroll bar was resulting in this error. This is fixed in the latest version. For previous versions, the work around was not to have HScroll bar when there is only one column in the browse.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xbrowse : sporadic error

Postby Demont Brecht » Mon Nov 07, 2011 9:04 am

Nages ,

I try to simulate the same error list from mine user. I have no intention to hide all the columns in a browse

Frank

nageswaragunupudi wrote:#1. You should never hide all columns. Atleast one column should be visible.

#2. When there is only one column in the browse, using horizontal scroll bar was resulting in this error. This is fixed in the latest version. For previous versions, the work around was not to have HScroll bar when there is only one column in the browse.
Demont Brecht
 
Posts: 55
Joined: Fri Jul 08, 2011 6:43 am

Re: xbrowse : sporadic error

Postby nageswaragunupudi » Mon Nov 07, 2011 9:18 am

Nages ,

I try to simulate the same error list from mine user. I have no intention to hide all the columns in a browse

Frank

I understand and appreciate.

This also means that we need to take care of a situation where the user by himself hides all columns. We need to protect this either in the application program or in xbrowse. Later option is better. We shall see how we can do this within xbrowse.prg. But for existing applications, the applications need to take care of this possibility. Thanks for your feedback.

We would also be interested in knowing if this error is encountered in any situations other than the two I mentioned above.

We are always grateful for your feedback, because that helps us to improve the library.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xbrowse : sporadic error

Postby Demont Brecht » Mon Nov 07, 2011 9:53 am

Rao ,

I tested to hide all columns (8.10) , but xbrowse doesn't allow to hide the last column.

Frank
Demont Brecht
 
Posts: 55
Joined: Fri Jul 08, 2011 6:43 am

Re: xbrowse : sporadic error

Postby nageswaragunupudi » Mon Nov 07, 2011 10:36 am

That means the user can not hide all columns.
If at all all columns are hidden that is done by the programmer. Ofcourse we expect the programmer not to do it. So this is not an issue.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: xbrowse : sporadic error

Postby ukservice » Mon Nov 07, 2011 10:59 am

Mr. Nao,

In my case, I don´t hide any columns.

The error appears just ramdonly.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: xbrowse : sporadic error

Postby ukservice » Tue Nov 15, 2011 10:33 am

Hello again,

I am getting this error more often. Sometimes when the dbf is empty.

Is there any advance?.

Thank you.
FWH 11.11, Harbour 3.1 and Borland C++ 5.82
User avatar
ukservice
 
Posts: 417
Joined: Tue Feb 23, 2010 3:09 pm
Location: John

Re: xbrowse : sporadic error

Postby Antonio Linares » Tue Nov 15, 2011 11:20 am

aDisplay is created from METHOD GetDisplayCols() CLASS TXBrowse, so I guess thats where we could place some traces:

1. If you are not using any frozen coluns, then this loop should not be executed:
Code: Select all  Expand view  RUN
  do while nFreeze > 0 .and. nCol <= nLen
      oCol := ::aCols[ nCol ]
      if ! oCol:lHide
         AAdd( aDisplay, nCol )
         oCol:nPos := Len( aDisplay )
         nFreeze--
      endif
      nCol++
   enddo


2. In the above case, aDisplay will be generated here:
Code: Select all  Expand view  RUN
  do while nCol <= nLen
      oCol := ::aCols[ nCol ]
      if ! oCol:lHide
         AAdd( aDisplay, nCol )
         oCol:nPos := Len( aDisplay )
      endif
      nCol++
   enddo


So we could place a trace just after it:
Code: Select all  Expand view  RUN
  if Len( aDisplay ) == 0
      MsgInfo( "aDisplay is zero! and nCol is: " + AllTrim( Str( nCol ) ) + " nLen is: " + AllTrim( Str( nLen ) ) )
   endif

   ::aDisplay := aDisplay
 


nLen is the total amount of columns.

For those of you that are able to reproduce the error, we kindly ask you to use the above trace and tell us what you get, thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 13 guests

cron