[ wxwindows-Bugs-1510741 ] crash with text+bitmap menu item on Win9x/Me+unicows

SourceForge.net noreply at sourceforge.net
Wed Jul 25 02:11:32 PDT 2007


Bugs item #1510741, was opened at 2006-06-22 15:25
Message generated for change (Comment added) made by mmacleod
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1510741&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: wxMSW specific
Group: Fatal
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Armel Asselin (aasselin)
Assigned to: Nobody/Anonymous (nobody)
Summary: crash with text+bitmap menu item on Win9x/Me+unicows

Initial Comment:
hello,

it seems that a test was made tighter in 2.6.3 and 
the code does not use anymore the InsertMenuItem 
function as it did previously in menu.cpp:416 (in 
DoInsertOrAppend) because of a restriction to the 
test:

if ( pItem->IsOwnerDrawn() )
{
    // is the item owner-drawn just because of the 
bitmap?
   if ( pItem->GetBitmap().Ok() &&
            !pItem->GetTextColour().Ok() &&
                !pItem->GetBackgroundColour().Ok() &&
                    !pItem->GetFont().Ok() &&
--------->>>>>>>>       !pItem->GetBitmap(true).Ok())
    {
        // try to use InsertMenuItem() as it's 
guaranteed to look correctly
        // while our owner-drawning code is not
        // first compile-time check
#ifdef MIIM_BITMAP

unfortunately the InsertMenu function which is used 
otherwise seems to be bugged in Unicows DLL (the 
pointer to the wxMenuItem is understood as a simple 
string though the MF_OWNERDRAW is well set, and 
converted to Unicode :(... when the message 
WM_MEASUREITEM comes to measure the item everything 
crashes)

removing the new test is enough to (dirtily) fix the 
problem, so i did this, but i suppose that the good 
way would be to _always_ use InsertMenuItem (at least 
when owner draw is on for an item)

Armel


----------------------------------------------------------------------

Comment By: Malcolm MacLeod (MaNI) (mmacleod)
Date: 2007-07-25 09:11

Message:
Logged In: YES 
user_id=1231512
Originator: NO

We are experience this same problem on the windows 98 build of our product
on wxWidgets 2.8.4
Below is the text for the patch I used to fix it (Patch is against latest
svn copy of file)
This is basically the same thing aasselin did to fix it, except for
windows98/MSLU only.


449c449,455
<         if ( (pItem->GetBitmap(false).Ok() ||
pItem->GetBitmap(true).Ok()) &&
---
> #if wxUSE_UNICODE_MSLU
>         if (wxGetWinVersion()<=wxWinVersion_98 ||(
> 			(pItem->GetBitmap(false).Ok() || pItem->GetBitmap(true).Ok())
> 			&& !pItem->GetTextColour().Ok() && !pItem->GetBackgroundColour().Ok()
&& !pItem->GetFont().Ok() 
> 			))
> #else 
> 		if ( (pItem->GetBitmap(false).Ok() || pItem->GetBitmap(true).Ok()) &&
452a459
> #endif


----------------------------------------------------------------------

Comment By: Armel Asselin (aasselin)
Date: 2006-06-23 18:59

Message:
Logged In: YES 
user_id=1234467

// now run-time one: MIIM_BITMAP only works
under WinME/2000+
the comment is unfortunately false from MSDN doc, if i 
read well (MIIM_BITMAP existed on Win98)
the app crashed also on WinME, so changing the test will 
not lead to anything different unfortunately.


----------------------------------------------------------------------

Comment By: Olly Betts (olly)
Date: 2006-06-23 09:34

Message:
Logged In: YES 
user_id=14972

I suspect this is the problem (a few lines further down
src/msw/menu.cpp):

            // now run-time one: MIIM_BITMAP only works
under WinME/2000+
            if ( wxGetWinVersion() >= wxWinVersion_98 )

The comment says ">= ME" but the code tests ">= 98"...

If you change that >= to a > does that fix your problem?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1510741&group_id=9863




More information about the wx-dev mailing list