Hi,
I have created component inherits from ThreadWithProgressWindow and in run which update model and call listener which eventually call component resized(), which is causing the crash.
If I change following to update UI, it loads UI after some time, what could be the issue, what am i doing wrong?
MessageManager::callAsync([=]
{
resized();
// call other memeber method
});
class MainComponent : public Component,
public DModel::DListener,
public ThreadWithProgressWindow
{
MainComponent::MainComponent()
{
// to get update when model change
model = new DModel();
model.addListerner(this);
launchThread(1);
}
void dUpdate(const String& str){
resized(); // crashes the code
}
void run()
{
while(!threadStop)
{
// when data count reach 100
if(datacount == 10)
{
threadStop = true;
break;
}
updateModel(model)
}
}
private:
DModel * model;
}
class DModel{
class DataListener
{
public:
/** Called when the button is clicked. */
virtual void dUpdate(const String& str) = 0;
}
public:
void dataUpdateSend(const String& str)
{
dataListeners.call( &DataListener::dUpdate, str);
}
}
void updateModel(DataModel* model)
{
model->dataUpdateSend("abc");
}