Re: Interrupt in Qt Event
Re: Interrupt in Qt Event
ok: this is my closing event for my main widget
void qtTest::closeEvent( QCloseEvent *event )
{
SystemClass* sys = m_widget->closeWindow();
sys->setDone();
sys->Shutdown();
delete sys;
sys = 0;
}
and this is my sys-> Run() function which is an endless loop which only stops if the done variable is set to true, which I do with my setDone() function:
void SystemClass::Run()
{
MSG msg;
bool result;
// Initialize the message structure.
ZeroMemory(&msg, sizeof(MSG));
// Loop until there is a quit message from the window or the user.
//done = false;
while(!done)
{
// Handle the windows messages.
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
// If windows signals to end the application then exit out.
if(msg.message == WM_QUIT)
{
done = true;
}
else
{
// Otherwise do the frame processing.
result = Frame();
if(!result)
{
done = true;
}
}
}
return;
}
The problem is that the Run function doesn't end because it is interrupted by the closing event. Do you know what I mean?
Re: Interrupt in Qt Event
And how is this related to Qt? The only thing involving Qt is that you have some code placed in closeEvent(). I don't even know how the close event is supposed to be delivered since you're not letting Qt process any events when you're stuck in the while loop. Or are you using threads?
Re: Interrupt in Qt Event
First of all variable done should be protected by mutex