Dear Author,
It is definitely bad practice to create handle (or smart pointer of any kind) to "this" pointer inside class method, as you cannot know if this object is actually allocated in dynamic memory.
Doing this in constructor is yet worse, for the reason described.
The code must be refactored to avoid this. For instance, class B in the example could accept pointer (or reference) to class A instead of handle.
Note that OCCT handles (and smart pointers in general) are means to control lifetime of dynamically created objects.
Since class B is created by instance of class A which he points to, it may not know how A is created and be responsible for destruction of A, hence may not use smart pointer to refer to it.
At the same time if you have found such stuff in OCCT classes I suggest you to register the issue in Mantis BugTracker or at least point out these classes (files) explicitly.
Best regards
FSR
Best regards
FSR