On Tue, Mar 26, 2024, 5:35 AM Juan Cristóbal Quesada <
juan.cristobal...@gmail.com> wrote:
> i just ask chatgpt what good practices are.
> i m glad to know that keeping a "global" reference prevents them to be
> deleted.
> Apart from what Justin said regarding the parent-child relationship.
> I
i just ask chatgpt what good practices are.
i m glad to know that keeping a "global" reference prevents them to be
deleted.
Apart from what Justin said regarding the parent-child relationship.
I guess that is all we should care about.
I had a very specific use case, where a derived QWidget class
When working with PySide objects, especially when interacting with Qt
objects implemented in C++, it's important to handle references correctly
to avoid memory issues and potential segmentation faults. Here are some
good programming practices to follow:
1. Parenting: Assign a parent to PySide
I'm not familiar with the widget being deleted during some intermediate
operations. Pyside has had some weird bugs related to python garbage
collection over the years, but from my understanding they have been
addressed in modern releases. Could still be edge cases or maybe an older
Pyside version.
Yeah, as i understand, it is good practice whenever you instantiate a
PySide object to, right after, to add it to a layout, which by default
would set its parent widget to the widget that holds the layout and keep
the hierarchy consistent.
The problem arises when this is not always done and you
When I ran into this, it has almost always been because of method
parameters initialized with default values in the constructor of some
PySide class. Let’s say class A gets instanced twice. If instance X is
garbage collected for whatever reason, when instance Y tries to use Y.b
it’ll complain
Qt (C++) usually honors the parent-child relationship, so it won't
automatically delete a widget unless its parent is being deleted. And if it
doesn't have a parent, it shouldn't be automatically deleted by reference
count unless it is wrapped in a smart pointer. Or maybe you have looked up
a
Hi Marcus, thanks for the reply.
You see, that is what i want to avoid at all costs. I dont want this thread
conversation to evolve following a concrete, specific use case, but rather
try to aim at "the bigger" picture. There are may examples of where and how
this C++ already deleted error
It would certainly help if you could provide an example of something that
causes the error, or at the very least a stacktrace of the error.
On Saturday 23 March 2024 at 18:04:59 UTC rainonthescare...@gmail.com wrote:
> Hi,
> i ve been working for quite some time now and occasionally bumped into