1. Win32Lib Bugs

Greetings.

I've been working on trying to fix some Win32Lib bugs, and I thought I'd
post them here, so others can take a shot at them. I'm stumped!

They are ordered by most to least critical.

Bug #1: Memory Errors in Lists

Win32Lib seems to barf when you click certain list items several times. The
common key seems to be a length of 12, such as "Robert Craig" or "orange
juice". The error is an invalid page default from EXW.EXE.

What's especially perplexing about this bug is that you sometimes have to
click the item several times to get it to fail. (Maybe it's triggering a
double-click behavior?)


Bug #2: Setting Scroll Bars

For reasons that *entirely* escape me, if you call a routine (such as
setScrollRange) that sends a message to a scrollbar, you can't create *any*
scrollbars after that event. There are no errors - the scrollbars simply are
not created.

Looking in Win32Lib, you can see that I rewrote setScrollRange() to call a
different API routine. But the effect is still the same.


Bug #3: Modal Window Focus

I've mentioned this before - in the simulated modal windows that Win32Lib
uses, when focus is moved off the "modal" window and then automatically
back, the non-modal window is not repainted as if it no longer had focus.

Any clues? Send me a note, please! I'm stumped!

Thanks!

-- David Cuny
dcuny at lanset.com

new topic     » topic index » view message » categorize

2. Win32Lib Bugs

To David, Daniel, Robert and all others interested in Win32 programming:

The 'invalid page default' that David is talking about, can also appear
using Visual Euphoria (version 0.02) by Daniel Berstein. If I define the
following:

cbJaar =3D NewControl(COMBOBOX, Form2)
SetAttribute(cbJaar, {
           {LEFT, 100},
                      {TOP, 140},
                      {WIDTH, 50},
                      {COMBOSTYLE, DROPDOWNLIST}})
--                      {MAXLENGTH, 5}})
The fault came up when the MAXLENGTH attribute was set. Running the progr=
am
right after that immediately crashes the program, so without adding
something to the combo or clicking it or something. When I comment out th=
e
MAXLENGTH line there's no problem.

My 2 eurocents opinion on this:
-- Possibly the fault is not in Win32Lib or VE, but in EXW.EXE.
-- If the fault is not in EXW.EXE, then I guess there can be (a) wrongly
defined message(s) in both libraries. Strangely, in the first case it is =
in
a listbox, and it only comes up on certain occasions, and in the second
case it is in a combo box.
-- Can there be any relation with the strange behavior of scroll controls=
?
After all, lists and combo's both are scrollable.
Is there anyone here that can shed a light on these strange X-file like
behavior?

BTW(17.5% here): Thanks go out to David Cuny for his excellent explanatio=
n
and example of onEvent[] programming.

Thanks
Ad Rienks

Original message: (partially)
>>Greetings.

I've been working on trying to fix some Win32Lib bugs, and I thought I'd
post them here, so others can take a shot at them. I'm stumped!

They are ordered by most to least critical.

Bug #1: Memory Errors in Lists

Win32Lib seems to barf when you click certain list items several times. T=
he
common key seems to be a length of 12, such as "Robert Craig" or "orange
juice". The error is an invalid page default from EXW.EXE.

What's especially perplexing about this bug is that you sometimes have to=

click the item several times to get it to fail. (Maybe it's triggering a
double-click behavior?)<<

new topic     » goto parent     » topic index » view message » categorize

3. Re: Win32Lib Bugs

Ad wrote:

> The 'invalid page default' that David is talking about,
> can also appear using Visual Euphoria (version 0.02) by
> Daniel Berstein.

Thanks. I've been busy with code other than Win32Lib, so I haven't had a
chance to further investivate the bugs. But I haven't ruled out Euphoria as
being at fault - especially when the bug causes the code to actually cause
EXW to crash, rather than simply generate an error from Windows.

> BTW(17.5% here)

You're quite welcome.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

4. Re: Win32Lib Bugs

Ad Rienks writes:
> The 'invalid page default' that David is talking about,
> can also appear using Visual Euphoria (version 0.02) by
> Daniel Berstein...
> ... Possibly the fault is not in Win32Lib or VE, but in EXW.EXE.

If any one has a reproducible error that they think is
due to a problem with exw.exe, please send me the
program so I can try to debug it.

With the aid of the WATCOM C debugger I can probably
find out why the crash is occurring. Keep in mind though that
a crash in exw.exe such as "invalid page fault" could be
caused by a bug in the WIN32 Euphoria program such as:
     * poking into a bad memory location
     * not allocating enough space for a structure
     * not using the correct offset for a field in a structure
     * freeing the space for a structure before you are finished
        using the structure
     * etc.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view message » categorize

5. Re: Win32Lib Bugs

To Robert Craig:

This is the program that caused the error. When you add a string into the=

listbox that is exactly 12 characters long, and than later you go into th=
e
list using mouseclicks or the cursor keys, you will see what happens. Thi=
s
did not occur only on my machine; Wolfgang Fritz and David Cuny were able=

to reproduce the bug also.

-- from Ex06.exw by David Cuny
-- This opens a window with a populated list in it.
-- Wolf added onChange[] to show it's use.
-- then added a button and an SLE to "fill" the listbox.

include win32lib.ew

constant
    Win   =3D create( Window, "List ++", 0, Default, Default, 160, 170, 0=
 ),
    List1 =3D create( List, "", Win, 10, 10, 120, 60, 0 ),    =

--  ^^ create a list-box window.
    Label1 =3D create(RText, "", Win, 10, 60, 120, 20, 0),
--  ^^ create a right-justified text display window.
    Sle1    =3D create( EditText, "", Win, 10, 80, 110, 20, 0 ),
--  ^^ create a little single-line-entry window.
    Button1 =3D create( PushButton, "ADD", Win, 70, 110, 60, 20, 0 )
--  ^^ and last, add a button to do something.

procedure onLoad_Win()
  -- add these items to the list-box    =

  addItem( List1, "one" )
  addItem( List1, "two" )
  addItem( List1, "three" )
  addItem( List1, "four" )
  setIndex(List1,0)
  setFocus(Sle1)
end procedure

procedure show_it(integer here)
-- show the selected list item in the text window.
sequence this
this=3DgetItem(List1,here)
setText(Label1, this)
end procedure

procedure onChange_List1()
-- get the latest index from the list-box, then show it.
atom where
where=3DgetIndex(List1)
show_it(where)
end procedure

procedure onClick_Button1( integer mouseX, integer mouseY )
sequence entry
  entry =3D getText( Sle1 )
  addItem( List1, entry )
  setText(Sle1, {} )
  setFocus(Sle1)
end procedure

onLoad[ Win ] =3D routine_id( "onLoad_Win" )
onChange[List1] =3D routine_id("onChange_List1")
-- ^^ this event handler is triggered whenever List1 changes state.
onClick[ Button1 ] =3D routine_id("onClick_Button1")

WinMain( Win )

new topic     » goto parent     » topic index » view message » categorize

6. Re: Win32Lib Bugs

>Ad Rienks writes:
>> The 'invalid page default' that David is talking about,
>> can also appear using Visual Euphoria (version 0.02) by
>> Daniel Berstein...
>> ... Possibly the fault is not in Win32Lib or VE, but in EXW.EXE.
>
>If any one has a reproducible error that they think is
>due to a problem with exw.exe, please send me the
>program so I can try to debug it.
>
>With the aid of the WATCOM C debugger I can probably
>find out why the crash is occurring. Keep in mind though that
>a crash in exw.exe such as "invalid page fault" could be
>caused by a bug in the WIN32 Euphoria program such as:
>     * poking into a bad memory location
>     * not allocating enough space for a structure
>     * not using the correct offset for a field in a structure
>     * freeing the space for a structure before you are finished
>        using the structure
>     * etc.
>


I don't have the time now to track down the bug. But I'm certain it's
not an exw.exw bug... Visual Euphoria runs completly from a
DLL written in Delphi. Perhaps it's a Windows bug, or more
probably some error I'm doing when creating the control (such as:
you can set this property after doing this other stuff).

Regards,
    Daniel   Berstein
    daber at pair.com

new topic     » goto parent     » topic index » view message » categorize

7. Re: Win32Lib Bugs

Ad Rienks writes:
> This is the program that caused the error. When you add a string
> into the listbox that is exactly 12 characters long, and than later
> you go into the list using mouseclicks or the cursor keys, you
> will see what happens. This did not occur only on my machine;
> Wolfgang Fritz and David Cuny were able to reproduce the
> bug also.

I've reproduced this bug now on my machine.

With the aid of the WATCOM debugger, I've determined that the
exw.exe heap (malloc/free area) is already corrupt inside the
routine getText() before this call to c_func() is made:

     iLength = c_func( xGetWindowTextLength, { hWnd } ) + 1

I clicked the ADD button after typing a 12-character
string. (I'm not sure if the length of the string is really that important).
I haven't found the place where this corruption actually takes
place. That may take a while. Maybe someone has an idea. It still
could be either a exw bug or a win32lib bug, I can't tell.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view message » categorize

8. Re: Win32Lib Bugs

Robert,

I don't think the bug is in the getText() routine. Please look at this
example where no adding of text takes place outside of the onLoad[Win]
procedure. The only thing I changed was to make "seventyseven" (a 12
character string) out of  "seven". Click this item and .... oops! So no
getText() involved here. The bug has to be in getItem, IMHO! If I comment=

that line out too, everything seems to go smooth!

-- from Ex06.exw by David Cuny
-- This opens a window with a populated list in it.

include win32lib.ew

constant
    Win   =3D create(Window, "List +", 0, Default, Default, 160, 110, 0),=

    List1 =3D create(List, "", Win, 10, 10, 120, 60, 0)
--  ^^ create a list-box window.
--    Label1 =3D create(RText, "", Win, 10, 60, 120, 20, 0) -- commented =
out!
--  ^^ create a right-justified text display window.

procedure onLoad_Win()
    -- add these items to the list-box    =

    addItem(List1, "one")
    addItem(List1, "two")
    addItem(List1, "three")
    addItem(List1, "four")
    addItem(List1, "five")
    addItem(List1, "six")
    addItem(List1, "seventyseven")
    setIndex(List1, 0)
-- ** add another line here !!
end procedure

procedure onDoubleClick_List(integer mouseX, integer mouseY)
integer what
sequence item
    what =3D getIndex(List1)
    item =3D getItem(List1, what)
--show_it(where)        -- also commented out, even all of show_it has
gone!
end procedure

onLoad[Win] =3D routine_id("onLoad_Win")
onDoubleClick[List1] =3D routine_id("onDoubleClick_List")

WinMain(Win)
-- end of wasex06.exw

Robert Craigs original message:
>>I've reproduced this bug now on my machine.

With the aid of the WATCOM debugger, I've determined that the
exw.exe heap (malloc/free area) is already corrupt inside the
routine getText() before this call to c_func() is made:

     iLength =3D c_func( xGetWindowTextLength, { hWnd } ) + 1

I clicked the ADD button after typing a 12-character
string. (I'm not sure if the length of the string is really that
important).
I haven't found the place where this corruption actually takes
place. That may take a while. Maybe someone has an idea. It still
could be either a exw bug or a win32lib bug, I can't tell.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/<<

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu