Display notification popup during trace cleanup.

This commit is contained in:
Bartosz Taudul 2019-07-24 23:54:47 +02:00
parent 076bf1b475
commit 7074b8ed8f

View File

@ -255,6 +255,9 @@ int main( int argc, char** argv )
std::thread loadThread; std::thread loadThread;
tracy::UdpListen* broadcastListen = nullptr; tracy::UdpListen* broadcastListen = nullptr;
enum class ViewShutdown { False, True, Join };
ViewShutdown viewShutdown = ViewShutdown::False;
std::mutex resolvLock; std::mutex resolvLock;
tracy::flat_hash_map<std::string, std::string> resolvMap; tracy::flat_hash_map<std::string, std::string> resolvMap;
ResolvService resolv; ResolvService resolv;
@ -554,7 +557,11 @@ int main( int argc, char** argv )
view->NotifyRootWindowSize( display_w, display_h ); view->NotifyRootWindowSize( display_w, display_h );
if( !view->Draw() ) if( !view->Draw() )
{ {
viewShutdown = ViewShutdown::True;
loadThread = std::thread( [&viewShutdown, view = std::move( view )] () mutable {
view.reset(); view.reset();
viewShutdown = ViewShutdown::Join;
} );
} }
} }
auto& progress = tracy::Worker::GetLoadProgress(); auto& progress = tracy::Worker::GetLoadProgress();
@ -624,6 +631,27 @@ int main( int argc, char** argv )
} }
ImGui::EndPopup(); ImGui::EndPopup();
} }
switch( viewShutdown )
{
case ViewShutdown::True:
ImGui::OpenPopup( "Capture cleanup..." );
break;
case ViewShutdown::Join:
loadThread.join();
viewShutdown = ViewShutdown::False;
break;
default:
break;
}
if( ImGui::BeginPopupModal( "Capture cleanup...", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
{
if( viewShutdown != ViewShutdown::True ) ImGui::CloseCurrentPopup();
tracy::TextCentered( ICON_FA_BROOM );
time += io.DeltaTime;
tracy::DrawWaitingDots( time );
ImGui::Text( "Please wait, cleanup is in progress" );
ImGui::EndPopup();
}
// Rendering // Rendering
ImGui::Render(); ImGui::Render();