mirror of https://github.com/KLayout/klayout.git
Fixed an issue with deferred method execution in unit test context.
This commit is contained in:
parent
eccbb9884c
commit
a5d675304c
|
|
@ -776,7 +776,10 @@ ApplicationBase::init_app ()
|
|||
// establish the configuration
|
||||
dispatcher ()->config_setup ();
|
||||
|
||||
// Some info output
|
||||
// deferred method processing for those plugins which need this
|
||||
process_events ();
|
||||
|
||||
// some info output
|
||||
if (tl::verbosity () >= 20) {
|
||||
|
||||
tl::info << "KLayout path:";
|
||||
|
|
@ -1504,6 +1507,9 @@ GuiApplication::process_events_impl (QEventLoop::ProcessEventsFlags flags, bool
|
|||
mp_mw->enter_busy_mode (true);
|
||||
try {
|
||||
QApplication::processEvents (flags);
|
||||
// Qt seems not to send posted UserEvents in some cases (e.g. in the unit test application with GLib?
|
||||
// Glib not doing this without a main window visible?). Hence we do this explicitly here.
|
||||
QApplication::sendPostedEvents ();
|
||||
} catch (...) {
|
||||
// ignore exceptions
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ namespace tl
|
|||
DeferredMethodSchedulerQt::DeferredMethodSchedulerQt ()
|
||||
: QObject (qApp), DeferredMethodScheduler ()
|
||||
{
|
||||
m_event_type = QEvent::registerEventType ();
|
||||
|
||||
connect (&m_timer, SIGNAL (timeout ()), this, SLOT (timer ()));
|
||||
|
||||
m_timer.setInterval (0); // immediately
|
||||
|
|
@ -51,13 +53,13 @@ DeferredMethodSchedulerQt::~DeferredMethodSchedulerQt ()
|
|||
void
|
||||
DeferredMethodSchedulerQt::queue_event ()
|
||||
{
|
||||
qApp->postEvent (this, new QEvent (QEvent::User));
|
||||
qApp->postEvent (this, new QEvent (QEvent::Type (m_event_type)));
|
||||
}
|
||||
|
||||
bool
|
||||
DeferredMethodSchedulerQt::event (QEvent *event)
|
||||
{
|
||||
if (event->type () == QEvent::User) {
|
||||
if (event->type () == m_event_type) {
|
||||
timer ();
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ private slots:
|
|||
|
||||
private:
|
||||
QTimer m_timer, m_fallback_timer;
|
||||
int m_event_type;
|
||||
|
||||
virtual bool event (QEvent *event);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ class IMG_TestClass < TestBase
|
|||
|
||||
end
|
||||
|
||||
def test_4
|
||||
def test_5
|
||||
|
||||
tmp = File::join($ut_testtmp, "tmp.lyimg")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue