gtk_events_pending() returns FALSE with events still pending

前端 未结 1 1815
难免孤独
难免孤独 2021-01-13 03:36

I\'m working on an application that has a start and stop button. These buttons block the UI, and for various reasons, I can\'t spawn a thread.

I\'ve been showing a w

相关标签:
1条回答
  • 2021-01-13 04:02

    Try g_main_context_pending(NULL) and g_main_context_iteration(NULL,FALSE) instead of gtk_events_pending(), the later is deprecated.


    It could be a timing issue that kicks in (it oculd be that your loop kicks in before any events are registered to the mainloop, and thus instantly exits) - but this is just wild guessing due to lack of code.


    The break condition is also wrong, you do not want to exit as soon as all events are processed at a specific point of time, you want to continue until long-run-ops are done. That means you need to signal when your operation is done, check that flag in the loop you currently use and use blocking mode of the *_iteration(...)

    0 讨论(0)
提交回复
热议问题