Advanced search
Log In
New Account
  
 
Home My Page Project Tree Code Snippets Project Openings Thuban
 
 
Summary Forums Tracker Lists Docs News SCM Files
 

Bugs: Browse | Download .csv

[#516] wx.MemoryDC fatal error on MacOSX

Please login

State:
Closed
Date:
2007-10-19 15:41
Priority:
3
Submitted By:
Didrik Pinte (dpinte)
Assigned To:
Nobody (None)
Summary:
wx.MemoryDC fatal error on MacOSX

Detailed description
When running Thuban on MacOSX compiled with wxPython 2.8, I get the following error : 


macmini:~/thuban/Thuban-1.2.0 did$ /usr/local/bin/python2.5 thuban.py
N'a pu trouver le module initial thubanstart
Une exception non g?r?e a ?t? d?clench?e:
C++ assertion "wxAssertFailure" failed in /BUILD/wxPython-src-2.6.4.0/src/mac/carbon/dc.cpp(1482): Invalid DC
(veuillez faire un rapport ? l'adresse http://thuban.intevation.org/bugtracker.html)

Traceback (most recent call last):
  File "thuban.py", line 35, in <module>
    Thuban.UI.main.main()
  File "/Users/did/thuban/Thuban-1.2.0/Thuban/UI/main.py", line 31, in main
    app = application.ThubanApplication(0)
  File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.6-mac-unicode/wx/_core.
py", line 7755, in __init__
    self._BootstrapApp()
  File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.6-mac-unicode/wx/_core.
py", line 7407, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "/Users/did/thuban/Thuban-1.2.0/Thuban/UI/application.py", line 77, in OnInit
    self.top = self.CreateMainWindow()
  File "/Users/did/thuban/Thuban-1.2.0/Thuban/UI/application.py", line 170, in CreateMainWindow
    size = (600, 400))
  File "/Users/did/thuban/Thuban-1.2.0/Thuban/UI/mainwindow.py", line 128, in __init__
    self.ShowLegend()
  File "/Users/did/thuban/Thuban-1.2.0/Thuban/UI/mainwindow.py", line 826, in ShowLegend
    self.ToggleLegend()
  File "/Users/did/thuban/Thuban-1.2.0/Thuban/UI/mainwindow.py", line 835, in ToggleLegend
    legend.LegendPanel(dialog, None, self)
  File "/Users/did/thuban/Thuban-1.2.0/Thuban/UI/legend.py", line 116, in __init__
    self.scalebarbitmap = ScaleBarBitmap(self, map, mainWindow)
  File "/Users/did/thuban/Thuban-1.2.0/Thuban/UI/legend.py", line 722, in __init__
    textwidth, textheight = dc.GetTextExtent("%d"%0)
  File "//Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/wx-2.6-mac-unicode/wx/_gdi.p
y", line 3493, in GetTextExtent
    return _gdi_.DC_GetTextExtent(*args, **kwargs)
PyAssertionError: C++ assertion "wxAssertFailure" failed
in /BUILD/wxPython-src-2.6.4.0/src/mac/carbon/dc.cpp(1482): Invalid DC

This seems related to the empty wx.MemoryDC created in legend.py. 

I found the same problem here : https://svn.enthought.com/enthought/ticket/710.

Changing the wx.MemoryDC to a wx.ScreenDC works fine. I will test this under Linux and Windows and patch the code if
it's ok.

Followup

Message
Date: 2009-07-10 09:17
Sender: Didrik Pinte

Closing the ticket as solved.
Date: 2008-06-10 13:45
Sender: Didrik Pinte

The patch has been applied to revision 2839.


Date: 2008-04-03 16:56
Sender: Didrik Pinte

Seems to run fine under Linux : 

Here is the diff :

Index: Thuban/UI/legend.py
=================================================================
==
--- Thuban/UI/legend.py	(revision 2839)
+++ Thuban/UI/legend.py	(working copy)
@@ -718,7 +718,7 @@
 
     def __init__(self, parent, map, mainWindow):
         # While the width is fixed, get the height _now_.
-        dc = wx.MemoryDC()
+        dc = wx.ScreenDC()
         textwidth, textheight
= dc.GetTextExtent("%d"%0)
         self.width = 210
         self.height = textheight + 3*2 + 8


I think it's the only place where it has to be changed. I'll
try to compile it again under MacOSX to validate the change.
Date: 2008-03-28 15:48
Sender: Bernhard Reiter

Didrik, how did your experiments with wx.ScreenDC go?
Was it helpful?

Attached Files:

Name Download
No Files Currently Attached

Changes:

Field Old Value Date By
close_date2009-07-10 09:172009-07-10 09:17dpinte
status_idOpen2009-07-10 09:17dpinte

This site is hosted by the Intevation GmbH