justDance
28th October 2012, 23:14
This Qt application I am working on has model view controller in main thread, while the data structure under dataModel and the data model are modified by a network working thread (basically it is getting data from server). The application crashes ramdonly. Based on my triage, it shows it crashes at some Qt deep model functions triggered by my data model modification. So I put lock on those data model functions. But now it still crashes.
What is right design for this case? I also tried to promote data model modification to main thread, which means once data structure is changed, it emits a signal to controller, then the slot function in controller modifies the data model. This crashes too. plus this design looks weird. data structure changes model directly seems a better design, but it will keep model in working thread. I looked at a lot of model/view examples, all of them model contains data and model is not in worker thread. So none of them is my case.
Thanks,
What is right design for this case? I also tried to promote data model modification to main thread, which means once data structure is changed, it emits a signal to controller, then the slot function in controller modifies the data model. This crashes too. plus this design looks weird. data structure changes model directly seems a better design, but it will keep model in working thread. I looked at a lot of model/view examples, all of them model contains data and model is not in worker thread. So none of them is my case.
Thanks,