Article # 425, added by Geoworks, historical record
| first | previous | index | next | last |

UI object trees crossing thread boundaries.



Q. I dynamically instantiate the generic objects in an object block
   owned by the process thread. I would like to display those objects
   and thus I need to attach them to the UI tree. However, the UI tree
   is owned by the ui-thread. Simply attaching these objects to the
   tree causes the error "OBJ_LOCK_OBJ_BLOCK_BY_WRONG_THREAD".

A. You cannot have normal generic objects under your GenApplication
   running in a different thread from the GenApplication objects and
   the objects underneath it. The only place where a thread boundary
   is allowed is the GenView/Content. The right thing to do is to
   change the owning thread of your object block to the ui-thread.

   Another way of overcoming this is to make the app single threaded,
   so everything is in the same thread.