There is a long-time request and is called from the “main” (UI) thread. It is planned to move it’s call into a separate thread. The problem is that some objects are created in this thread on the heap (main thread will have to work with these pointers).
Questions:
- Is it allowed to delete ‘another-thread’ objects in the main thread?
- Is it a good idea to delete object in “another” thread.
Yes.
Depending on situation, this is not bad and not good, just do what you need according to your algorithm.
Deleting objects created in another thread may be dangerous only if object destructor works with a thread local storage. This must be mentioned in the class documentation.