1. Bug in Win32Lib 0.70.4

CChris, I've found a bug in 0.70.4, in the restoreMousePointer routine calls. It
fails with Error code 472, getRect:GetWindowRect failed when there is a popup
menu. It seems to try a getRect on the popup which crashes the prog. The
following shows the error.

without warning
include win32lib.ew
constant Main = create(Window, "Test", 0, 0, 0, 200, 100, 0)
constant pop = create(Popup, "", Main, 0, 0, 0, 0, 0)
constant Item = create(MenuItem, "Option 1", pop, 0, 0, 0, 0, 0)

global procedure Win_OnOpen( integer self, integer event, sequence parms)
    setMousePointer( {Main}, WaitPointer )
    restoreMousePointer({Main})
end procedure
setHandler(Main, w32HOpen, routine_id("Win_OnOpen") )

WinMain(Main, Normal)


if I do a setMousePointer( {Main}, ArrowPointer ) instead of the
restoreMousePointer its fine.

PeteS

new topic     » topic index » view message » categorize

2. Re: Bug in Win32Lib 0.70.4

Pete Stoner wrote:
> 
> CChris, I've found a bug in 0.70.4, in the restoreMousePointer routine calls.
> It fails with Error code 472, getRect:GetWindowRect failed when there is a
> popup
> menu. It seems to try a getRect on the popup which crashes the prog. The
> following
> shows the error.
> 
> }}}
<eucode>
> without warning
> include win32lib.ew
> constant Main = create(Window, "Test", 0, 0, 0, 200, 100, 0)
> constant pop = create(Popup, "", Main, 0, 0, 0, 0, 0)
> constant Item = create(MenuItem, "Option 1", pop, 0, 0, 0, 0, 0)
> 
> global procedure Win_OnOpen( integer self, integer event, sequence parms)
>     setMousePointer( {Main}, WaitPointer )
>     restoreMousePointer({Main})
> end procedure
> setHandler(Main, w32HOpen, routine_id("Win_OnOpen") )
> 
> WinMain(Main, Normal)
> </eucode>
{{{

> 
> if I do a setMousePointer( {Main}, ArrowPointer ) instead of the
> restoreMousePointer
> its fine.
> 
> PeteS


Thanks for reporting tis.
I'm on vacation right now and don't have the code base at hand. When I'm back to
business, rougyhlyh 1 month from now, I can correct this issue when a child of
{id} is a menu or similar.

CChris

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

3. Re: Bug in Win32Lib 0.70.4

Hi,

Almost a year ago Pete Stoner reported an issue with win32lib v0.70.4 where it fails with when there is a restoreMousePointer call whilst a popup menu is open.

	Error Code 472 
	getRect:GetWindowRect failed. 

The problem still exists in v0.70.4a. Is there any chance of a fix being made?

Cheers,
Mark

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

4. Re: Bug in Win32Lib 0.70.4

marky1124 said...

Hi,

Almost a year ago Pete Stoner reported an issue with win32lib v0.70.4 where it fails with when there is a restoreMousePointer call whilst a popup menu is open.

	Error Code 472 
	getRect:GetWindowRect failed. 

The problem still exists in v0.70.4a. Is there any chance of a fix being made?

Cheers,
Mark

Can you post the code where this happens? Or send it over to oedoc hat free doubt fr ? From the tests I had made, the issue was fixed. Thanks.

CChris

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

5. Re: Bug in Win32Lib 0.70.4

CChris said...

Can you post the code where this happens?

Hi Chris,

It fails for me using the test code provided by Pete in the first post of this thread. I have downloaded a fresh copy of Win32lib v0.70.4a and it fails using that. I checked for differences between the vanilla v0.70.4a and the one I had and the only change is to w32replaceItem() which was provided to me by you blink

E.g.

	-- Fix as per CChris to cope with pNew containing pOld 
        -- http://openeuphoria.org/EUforum/index.cgi?module=forum&action=flat&id=103817 
        -- This fix hopefully will be included in a future release of win32lib 
        -- lFrom += lLenNew 
        lFrom = lPos + lLenNew 
CChris said...

Or send it over to oedoc hat free doubt fr ?

I was slow to realise what you were asking for here. Now I've typed this I realise that you've provided a hidden email address to avoid robot spam list generators. Changing hat for at and doubt for dot. It's a new one on me. If you haven't replied here in the next few days I'll try your email address.

Cheers, Mark

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

6. Re: Bug in Win32Lib 0.70.4

marky1124 said...
CChris said...

Can you post the code where this happens?

Hi Chris,

It fails for me using the test code provided by Pete in the first post of this thread. I have downloaded a fresh copy of Win32lib v0.70.4a and it fails using that. I checked for differences between the vanilla v0.70.4a and the one I had and the only change is to w32replaceItem() which was provided to me by you blink

E.g.

	-- Fix as per CChris to cope with pNew containing pOld 
        -- http://openeuphoria.org/EUforum/index.cgi?module=forum&action=flat&id=103817 
        -- This fix hopefully will be included in a future release of win32lib 
        -- lFrom += lLenNew 
        lFrom = lPos + lLenNew 
CChris said...

Or send it over to oedoc hat free doubt fr ?

I was slow to realise what you were asking for here. Now I've typed this I realise that you've provided a hidden email address to avoid robot spam list generators. Changing hat for at and doubt for dot. It's a new one on me. If you haven't replied here in the next few days I'll try your email address.

Cheers, Mark

Bug squashed, in getRect(): Popups were not treated as Menus, while they should have. 1/ line 14615 reads:

        ctltype=find(ctrl_Family[id],{MENU,MENUITEM}) 

Replace with

        ctltype=find(ctrl_Family[id],{MENU,MENUITEM,POPUP}) 

2/ line 14681 has condition

if ctltype=1 

Replace it with

ctrl_Family[id]!=MENUITEM 

CChris

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

7. Re: Bug in Win32Lib 0.70.4

Hi CChris,

Thank you very much for that. You've certainly fixed the original test code that Pete provided. Unfortunately the problem still exists in the main application. When the application is starting it runs restoreMousePointer({wResMan}) which leads to the crash. I turned on "with trace" on line 442 of win32lib.ew and put a trace(1) just before the application calls restoreMousePointer(). This from the ex_conv.err :-

c:\euphoria\win32lib\Include\w32msgs.e:113 in procedure fShowError()  
attempt to divide by 0  
    pParams = { 
                "getRect:GetWindowRect failed.", 
                472 
              } 
    pMode = 2 
    lErrCode = 472 
    lResponse = 1 
    lStyle = 16 
    s = "getRect:GetWindowRect failed." 
    lDispMsg = "Error code 472\ngetRect:GetWindowRect failed.\n\nWin32Lib v0.70.4 17-Jun-2008" 
    lTitle = "Win32Lib AppWindow - Fatal Error" 
 
... called from c:\euphoria\win32lib\Include\w32msgs.e:146 in procedure abortErr()   
    pParams = { 
                "getRect:GetWindowRect failed.", 
                472 
              } 
 
... called from c:\euphoria\win32lib\Include\Win32lib.ew:14656 in function getRect()   
    id = 36'$' 
    top = <no value> 
    bottom = <no value> 
    left = <no value> 
    right = <no value> 
    ctltype = 0 
    struct = 35704780 
    pt = <no value> 
    hdc = <no value> 
    mset = 10405380 
    bufsize = <no value> 
    hWnd = <no value> 
    xy = <no value> 
    retval = {0,0,0,0} 
    i = <no value> 
 
 
... called from c:\euphoria\win32lib\Include\Win32lib.ew:5586 in function isScreenPointIn()   
    id = 36'$' 
    pX = 560 
    pY = 319 
    lScreenRect = <no value> 
 
... called from c:\euphoria\win32lib\Include\w32resources.ew:5128 in procedure restoreMousePointer_()   
    id = 36'$' 
    depth = 2 
    lKids = {} 
    lCursors = {65555} 
    mouse_pos = {560,319} 
    i = 1 
 
... called from c:\euphoria\win32lib\Include\w32resources.ew:5118 in procedure restoreMousePointer_()   
    id = ")" 
    depth = 1 
    lKids = { 
              "$(", 
              {39,15}, 
              {40,19}, 
              "3(", 
              {63,15}, 
              {64,19}, 
              {65,15}, 
              {66,19}, 
              {68,17}, 
              {69,17}, 
              {71,17}, 
              "S/" 
            } 
    lCursors = <no value> 
    mouse_pos = <no value> 
    i = 1 
 
... called from c:\euphoria\win32lib\Include\w32resources.ew:5118 in procedure restoreMousePointer_()   
    id = {3} 
    depth = 0 
    lKids = { 
              {4,18}, 
              {5,18}, 
              {6,18}, 
              {7,18}, 
              {8,15}, 
              {9,18}, 
              {10,15}, 
              {11,16}, 
              {12,18}, 
              {13,15}, 
              {14,19}, 
              {15,15}, 
              {16,15}, 
              {17,2}, 
              {18,15}, 
              {19,15}, 
              {20,18}, 
              {21,15}, 
              {22,15}, 
              {23,15}, 
              {24,15}, 
              {25,18}, 
              {26,15}, 
              {27,18}, 
              {28,16}, 
              {29,18}, 
              {30,2}, 
              {31,15}, 
              {32,18}, 
              {33,15}, 
              {34,16}, 
              {35,16}, 
              "%'", 
              {38,15}, 
              {41,8}, 
              {42,15}, 
              {43,15}, 
              {44,19}, 
              {45,15}, 
              {46,15}, 
              {47,15}, 
              {48,18}, 
              {49,15}, 
              {50,19}, 
              {52,2}, 
              {53,2}, 
              {54,2}, 
              {55,2}, 
              {57,2}, 
              {58,19}, 
              {59,2}, 
              {60,3}, 
              {61,2}, 
              {62,16}, 
              {67,17}, 
              {70,17}, 
              {72,17}, 
              {73,17}, 
              {74,17}, 
              {75,17}, 
              {76,17}, 
              {77,17}, 
              {78,17}, 
              {79,17}, 
              {80,17}, 
              {81,17}, 
              {82,17}, 
              {98,1}, 
              {125,1}, 
              {239,1}, 
              {282,1}, 
              {386,24}, 
              {499,25}, 
              {510,25} 
            } 
    lCursors = <no value> 
    mouse_pos = <no value> 
    i = 35'#' 
 
... called from c:\euphoria\win32lib\Include\w32resources.ew:5157 in procedure restoreMousePointer()   
    id = {3} 
 
... called from .\ResManWindowRoutines.ew:3155 in procedure OnOpen_ResManWin()   
<snip> 



The final lines leading up to the divide by zero are:

Traced lines leading up to the failure: 
 
C:\EUPHORIA\include\machine.e:113	    machine_proc(M_FREE, a) 
C:\EUPHORIA\include\machine.e:114	end procedure 
C:\EUPHORIA\include\machine.e:63	    return a > 0 and a <= MAX_ADDR and floor(a) = a 
C:\EUPHORIA\include\machine.e:113	    machine_proc(M_FREE, a) 
C:\EUPHORIA\include\machine.e:114	end procedure 
C:\EUPHORIA\include\machine.e:63	    return a > 0 and a <= MAX_ADDR and floor(a) = a 
C:\EUPHORIA\include\machine.e:113	    machine_proc(M_FREE, a) 
C:\EUPHORIA\include\machine.e:114	end procedure 
C:\EUPHORIA\include\machine.e:63	    return a > 0 and a <= MAX_ADDR and floor(a) = a 
C:\EUPHORIA\include\machine.e:113	    machine_proc(M_FREE, a) 
C:\EUPHORIA\include\machine.e:114	end procedure 
c:\euphoria\win32lib\Include\Win32lib.ew:567	    vWinMainState = kFinished 
c:\euphoria\win32lib\Include\Win32lib.ew:568	end procedure 
c:\euphoria\win32lib\Include\Win32lib.ew:24996	end procedure 
c:\euphoria\win32lib\Include\Win32lib.ew:25737	    return 0 
c:\euphoria\win32lib\Include\w32msgs.e:37	            if lRC = -1 then 
c:\euphoria\win32lib\Include\w32msgs.e:40	        end for 
c:\euphoria\win32lib\Include\w32msgs.e:41	        xUserCleanUp = lUserCleanUp 
c:\euphoria\win32lib\Include\w32msgs.e:44	end procedure 
c:\euphoria\win32lib\Include\w32msgs.e:108	        if pMode = 2 then 
c:\euphoria\win32lib\Include\w32msgs.e:110	            crash_message(lDispMsg) 
C:\EUPHORIA\include\machine.e:232	    machine_proc(M_CRASH_MESSAGE, msg) 
C:\EUPHORIA\include\machine.e:233	end procedure 
c:\euphoria\win32lib\Include\w32msgs.e:112	        if pMode != 3 then 
c:\euphoria\win32lib\Include\w32msgs.e:113	            abort(1/0) -- Force the ex.err to be created. 



I suspect a little more of your magic is required to fix this properly. If the above is of no use I will attempt to create another piece of test code to demonstrate the problem.

All the best,
Mark

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

Search



Quick Links

User menu

Not signed in.

Misc Menu