C++ assertion in PopupMenu

My commercial app is built with py2exe bundled with Python 2.5.2, wxPython 2.8.9.1, Dabo 0.9.0 and other libraries. I just received an automated error report I've never seen before and can't seem to reproduce on my system.

Can anyone help me diagnose, from this limited information, what could be the problem?

Here's the Dabo code for showContextMenu() in the version of Dabo that was bundled with this version of my app:

http://trac.dabodev.com/browser/trunk/dabo/ui/uiwx/dPemMixin.py?rev=4821#L1040

Here's the automated error message I received:

{{{
------- Error Notification

          Customer: ---------------
           License: e9b24db9-3fa4-4480-9781-ea2fca68e7f3
    User Timestamp: 2008-12-18 01:31:36.775000
  Server Timestamp: 2008-12-18 01:31:31.080598
Version, Platform: 0.9.27 Windows-XP-5.1.2600-SP2
  Exception Object: C++ assertion "(nBmpWidth <= rc.GetWidth()) && (nBmpHeight <= rc.GetHeight())" failed at ..\..\src\msw\ownerdrw.cpp(465) in wxOwnerDrawn::OnDrawItem()
    Exception Type: <class 'wx._core.PyAssertionError'>
       Active Form: <frmProductionOrders (baseclass dabo.ui.dForm, id:-4215)>
    Active Control: <grdProductionOrderOpenings (baseclass dabo.ui.dGrid, id:-4264)>

Traceback (most recent call last):
   File "dabo\ui\uiwx\dGrid.pyc", line 3848, in __onWxMouseRightUp
   File "dabo\ui\uiwx\dPemMixin.pyc", line 942, in raiseEvent
   File "dabo\lib\eventMixin.pyc", line 92, in raiseEvent
   File "dabo\ui\uiwx\dGrid.pyc", line 3329, in _onGridMouseRightClick
   File "dabo\ui\uiwx\dPemMixin.pyc", line 1051, in showContextMenu
   File "wx\_core.pyc", line 10206, in PopupMenu
<class 'wx._core.PyAssertionError'>: C++ assertion "(nBmpWidth <= rc.GetWidth()) && (nBmpHeight <= rc.GetHeight())" failed at ..\..\src\msw\ownerdrw.cpp(465) in wxOwnerDrawn::OnDrawItem()

···

=======================================================
User Notes:

=======================================================
}}}

Paul

Paul McNett wrote:

My commercial app is built with py2exe bundled with Python 2.5.2, wxPython 2.8.9.1, Dabo 0.9.0 and other libraries. I just received an automated error report I've never seen before and can't seem to reproduce on my system.

Can anyone help me diagnose, from this limited information, what could be the problem?

Here's the Dabo code for showContextMenu() in the version of Dabo that was bundled with this version of my app:

http://trac.dabodev.com/browser/trunk/dabo/ui/uiwx/dPemMixin.py?rev=4821#L1040

Here's the automated error message I received:

{{{
------- Error Notification

         Customer: ---------------
          License: e9b24db9-3fa4-4480-9781-ea2fca68e7f3
   User Timestamp: 2008-12-18 01:31:36.775000
Server Timestamp: 2008-12-18 01:31:31.080598
Version, Platform: 0.9.27 Windows-XP-5.1.2600-SP2
Exception Object: C++ assertion "(nBmpWidth <= rc.GetWidth()) && (nBmpHeight <= rc.GetHeight())" failed at ..\..\src\msw\ownerdrw.cpp(465) in wxOwnerDrawn::OnDrawItem()
   Exception Type: <class 'wx._core.PyAssertionError'>
      Active Form: <frmProductionOrders (baseclass dabo.ui.dForm, id:-4215)>
   Active Control: <grdProductionOrderOpenings (baseclass dabo.ui.dGrid, id:-4264)>

Traceback (most recent call last):
  File "dabo\ui\uiwx\dGrid.pyc", line 3848, in __onWxMouseRightUp
  File "dabo\ui\uiwx\dPemMixin.pyc", line 942, in raiseEvent
  File "dabo\lib\eventMixin.pyc", line 92, in raiseEvent
  File "dabo\ui\uiwx\dGrid.pyc", line 3329, in _onGridMouseRightClick
  File "dabo\ui\uiwx\dPemMixin.pyc", line 1051, in showContextMenu
  File "wx\_core.pyc", line 10206, in PopupMenu
<class 'wx._core.PyAssertionError'>: C++ assertion "(nBmpWidth <= rc.GetWidth()) && (nBmpHeight <= rc.GetHeight())" failed at ..\..\src\msw\ownerdrw.cpp(465) in wxOwnerDrawn::OnDrawItem()

http://trac.wxwidgets.org/browser/wxWidgets/branches/WX_2_8_BRANCH/src/msw/ownerdrw.cpp#L465

It looks to me like it is happening because the bitmap is larger in at least one dimension (probably the height) than the rectangle passed in to the function. Perhaps the user's system preferences has a smaller than normal font configured for menu items?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Paul McNett wrote:

My commercial app is built with py2exe bundled with Python 2.5.2, wxPython 2.8.9.1, Dabo 0.9.0 and other libraries. I just received an automated error report I've never seen before and can't seem to reproduce on my system.

Can anyone help me diagnose, from this limited information, what could be the problem?

Here's the Dabo code for showContextMenu() in the version of Dabo that was bundled with this version of my app:

http://trac.dabodev.com/browser/trunk/dabo/ui/uiwx/dPemMixin.py?rev=4821#L1040

Here's the automated error message I received:

{{{
------- Error Notification

         Customer: ---------------
          License: e9b24db9-3fa4-4480-9781-ea2fca68e7f3
   User Timestamp: 2008-12-18 01:31:36.775000
Server Timestamp: 2008-12-18 01:31:31.080598
Version, Platform: 0.9.27 Windows-XP-5.1.2600-SP2
Exception Object: C++ assertion "(nBmpWidth <= rc.GetWidth()) && (nBmpHeight <= rc.GetHeight())" failed at ..\..\src\msw\ownerdrw.cpp(465) in wxOwnerDrawn::OnDrawItem()
   Exception Type: <class 'wx._core.PyAssertionError'>
      Active Form: <frmProductionOrders (baseclass dabo.ui.dForm, id:-4215)>
   Active Control: <grdProductionOrderOpenings (baseclass dabo.ui.dGrid, id:-4264)>

Traceback (most recent call last):
  File "dabo\ui\uiwx\dGrid.pyc", line 3848, in __onWxMouseRightUp
  File "dabo\ui\uiwx\dPemMixin.pyc", line 942, in raiseEvent
  File "dabo\lib\eventMixin.pyc", line 92, in raiseEvent
  File "dabo\ui\uiwx\dGrid.pyc", line 3329, in _onGridMouseRightClick
  File "dabo\ui\uiwx\dPemMixin.pyc", line 1051, in showContextMenu
  File "wx\_core.pyc", line 10206, in PopupMenu
<class 'wx._core.PyAssertionError'>: C++ assertion "(nBmpWidth <= rc.GetWidth()) && (nBmpHeight <= rc.GetHeight())" failed at ..\..\src\msw\ownerdrw.cpp(465) in wxOwnerDrawn::OnDrawItem()

http://trac.wxwidgets.org/browser/wxWidgets/branches/WX_2_8_BRANCH/src/msw/ownerdrw.cpp#L465

It looks to me like it is happening because the bitmap is larger in at least one dimension (probably the height) than the rectangle passed in to the function. Perhaps the user's system preferences has a smaller than normal font configured for menu items?

I just tested this theory, and still couldn't reproduce. I set the menu font in system preferences to Tahoma size 3. Then I ran my app, and right-clicked on the grid, and saw my popup menu with the bitmaps rendered fine, and the text was too small to read as expected. I'm on WinXP Service Pack 3, while this user is only on Service Pack 2, so it still could be that your theory is correct if Microsoft fixed something under the hood.

I see that the user has logged into the app dozens of times over the past few days, but this error only happened the once, so it could be that a very specific circumstance causes the error, in which case I'm probably not ever going to be able to reproduce it.

Can you think of any system setting that would make the *bitmap* scale too large to fit in the allocated width or height?

Paul

Paul