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 occurs. Im sure we all can think of one example in our code.
My question, generally speaking, was aiming at preventing this to happen at all costs by following a "good coding practice" convention.
For example, is it good practice to store every python widget in a static class variable? would that avoid all these kinds of errors? What if you store a QWidget object in a python list and then try to access it because it got registered as a subscriber, but, at the moment of calling the method you subscribed for, the C++ bound object no longer exists because the C++ reference count went to zero?? Is it good practice to try to use the shiboken2.isValid() method to validate everytime the C++ Widget pointer? all over the code? and to use the MQtUtil.findControl() method to retrieve a C++ alive pointer to a widget? What if we need to store a widget temporarily with no parent so we are able to further on perform a setParent() but the C++ object was already destroyed?
All these are use cases that we all can encounter. Im just trying to figure out a general method to avoid all these problems ,specially to the more junior TDs, Tech Artists, etc.
That s why i was asking for a "general rule" to avoid these use cases. Again, i would not like to make a discussion here out of a specific use case. But rather, mostly curious towards how the more senior profiles tackle with this.
Thanks!!