Segmentation Fault (Sorry! This question again)

Sorry if someone already answer my question but I was in vacation and dont saw it. If this question is already answed, just tell me that I will find in the files of the list.

I have to add some objects and an arrow to link them. The problem is when I delete the object, I need that the arrows of this object are deleted too and a new arrow to link the remaining objects. When I try to do this the new line isnt created and if I try to move the objects I have a Segmentation Fault.

I have attached a example of the problem, adding with right click and deleting in delete button.

Diego

test.py (3.89 KB)

Diego Galho Prestes wrote:

Sorry if someone already answer my question but I was in vacation and dont saw it. If this question is already answed, just tell me that I will find in the files of the list.

I have to add some objects and an arrow to link them. The problem is when I delete the object, I need that the arrows of this object are deleted too and a new arrow to link the remaining objects. When I try to do this the new line isnt created and if I try to move the objects I have a Segmentation Fault.

I have attached a example of the problem, adding with right click and deleting in delete button.

I'm not seeing any segfaults in your sample, but I am seeing errors resulting from trying to use deleted objects:

Traceback (most recent call last):
   File "tmp/test/testOGL.py", line 84, in EventoKey
     self.Delete()
   File "tmp/test/testOGL.py", line 114, in Delete
     fromShape.AddLine(line, toShape)
   File "/usr/lib/python2.2/site-packages/wxPython/oglbasic.py", line 499, in AddLine
     val = oglbasicc.wxPyShape_AddLine(self, *_args, **_kwargs)
TypeError: Type error in argument 3 of wxPyShape_AddLine. Expected _wxPyShape_p.

Adding a line to print toShape gives this:

wxPython wrapper for DELETED wxPyRectangleShape object! (The C++ object no longer exists.)

···

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

Possibly wxPython has become a bit more forgiving in the last minor
update. I had some problems with OGL which I tracked down to garbage
collection? problems where supposedly the python wrapper object died at a
different time than the C++ object. In my case I had Python objects
in a list which contained OGL objects. Trashing this list gave me spurious
core dumps which led to the inclusion of destructor methods whose only job
was to destroy the OGL objects cleanly.

Torsten

···

On Mon, 28 Jul 2003, Robin Dunn wrote:

Diego Galho Prestes wrote:
> Sorry if someone already answer my question but I was in vacation and
> dont saw it. If this question is already answed, just tell me that I
> will find in the files of the list.
>
> I have to add some objects and an arrow to link them. The problem is
> when I delete the object, I need that the arrows of this object are
> deleted too and a new arrow to link the remaining objects. When I try to
> do this the new line isnt created and if I try to move the objects I
> have a Segmentation Fault.
>
> I have attached a example of the problem, adding with right click and
> deleting in delete button.
>

I'm not seeing any segfaults in your sample, but I am seeing errors
resulting from trying to use deleted objects:

Traceback (most recent call last):
   File "tmp/test/testOGL.py", line 84, in EventoKey
     self.Delete()
   File "tmp/test/testOGL.py", line 114, in Delete
     fromShape.AddLine(line, toShape)
   File "/usr/lib/python2.2/site-packages/wxPython/oglbasic.py", line
499, in AddLine
     val = oglbasicc.wxPyShape_AddLine(self, *_args, **_kwargs)
TypeError: Type error in argument 3 of wxPyShape_AddLine. Expected
_wxPyShape_p.

Adding a line to print toShape gives this:

wxPython wrapper for DELETED wxPyRectangleShape object! (The C++ object
no longer exists.)

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

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Hi,

is there a possibility to set a default device context for a
wxShapeCanvas? I need scaling and bottomToTop x-axis. My code works fine
but it is a bit tedious to find all methods which I have to override
(OnDraw() solves only part of the problem).

Torsten

Torsten Sadowski wrote:

Hi,

is there a possibility to set a default device context for a
wxShapeCanvas? I need scaling and bottomToTop x-axis. My code works fine
but it is a bit tedious to find all methods which I have to override
(OnDraw() solves only part of the problem).

No.

DC's are designed to be created when needed and then released again. Plus, since there are various types of DC's that should be used in different situations it makes no sense to create just one that is used all the time.

···

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