diff --git a/src/blackcore/airspacemonitor.cpp b/src/blackcore/airspacemonitor.cpp index 244c9fbfc..9ab13f235 100644 --- a/src/blackcore/airspacemonitor.cpp +++ b/src/blackcore/airspacemonitor.cpp @@ -156,6 +156,7 @@ namespace BlackCore CFlightPlan CAirspaceMonitor::loadFlightPlanFromNetwork(const CCallsign &callsign) { CFlightPlan plan; + QPointer myself(this); // use cache, but not for own callsign (always reload) if (m_flightPlanCache.contains(callsign)) { plan = m_flightPlanCache[callsign]; } @@ -167,12 +168,12 @@ namespace BlackCore // with this little trick we try to make an asynchronous signal / slot // based approach a synchronous return value const QTime waitForFlightPlan = QTime::currentTime().addMSecs(1000); - while (QTime::currentTime() < waitForFlightPlan) + while (sApp && QTime::currentTime() < waitForFlightPlan) { // process some other events and hope network answer is received already // CEventLoop::processEventsUntil cannot be used, as a received flight plan might be for another callsign sApp->processEventsFor(100); - if (!sApp || sApp->isShuttingDown()) { return CFlightPlan(); } + if (!myself || !sApp || sApp->isShuttingDown()) { return CFlightPlan(); } if (m_flightPlanCache.contains(callsign)) { plan = m_flightPlanCache[callsign]; diff --git a/src/blackgui/components/flightplancomponent.cpp b/src/blackgui/components/flightplancomponent.cpp index 534f83c8e..9f08cd573 100644 --- a/src/blackgui/components/flightplancomponent.cpp +++ b/src/blackgui/components/flightplancomponent.cpp @@ -447,7 +447,14 @@ namespace BlackGui m = CStatusMessage(this).validationError(u"No errors, but not connected, cannot send flight plan"); } ui->le_LastSent->setText(lastSent); - this->showOverlayMessage(m, OverlayMessageMs); + if (m.isSeverityInfoOrLess()) + { + this->showOverlayHTMLMessage(m, OverlayTimeoutMs); + } + else + { + this->showOverlayMessage(m, OverlayTimeoutMs); + } m_sentFlightPlan = flightPlan; // last valid FP } else @@ -496,7 +503,7 @@ namespace BlackGui } else { - this->showOverlayMessages(msgs, OverlayMessageMs); + this->showOverlayMessages(msgs, OverlayTimeoutMs); } } @@ -789,7 +796,7 @@ namespace BlackGui } // messages - this->showOverlayMessages(msgs, false, OverlayMessageMs); + this->showOverlayMessages(msgs, false, OverlayTimeoutMs); // copy over if (msgs.isSuccess()) diff --git a/src/blackgui/components/flightplancomponent.h b/src/blackgui/components/flightplancomponent.h index ea4198b8d..f31e97b5d 100644 --- a/src/blackgui/components/flightplancomponent.h +++ b/src/blackgui/components/flightplancomponent.h @@ -73,8 +73,6 @@ namespace BlackGui BlackMisc::CDataReadOnly m_lastAircraftModel { this }; //!< recently used aircraft model BlackMisc::CDataReadOnly m_lastServer { this }; //!< recently used server (VATSIM, other) - static constexpr int OverlayMessageMs = 5000; - //! Validate, generates status messages BlackMisc::CStatusMessageList validateAndInitializeFlightPlan(BlackMisc::Aviation::CFlightPlan &fligtPlan);