简体   繁体   English

c-使用“ g_spawn_async_with_pipes()”时,GTK3.0 GUI冻结

[英]c - GTK3.0 GUI freezes when using “g_spawn_async_with_pipes()”

I've written a very simple front end for ffmpeg (converting stuff: video -> mp3) in GTK3.0/C for linux. 我已经在Linux的GTK3.0 / C中为ffmpeg (转换内容:视频-> mp3)编写了一个非常简单的前端。 For spawning ffmpeg I use g_spawn_async_with_pipes() . 对于生成ffmpeg,我使用g_spawn_async_with_pipes() I thought this was the right way to execute stuff like that without having the GUI freeze up - but it does though. 我认为这是在不冻结GUI的情况下执行类似操作的正确方法,但是确实如此。 So - how can I prevent it from freezing - so I can fe display a spinner? 那么-如何防止其冻结-这样我才能展示微调器?

You might need to add something like" 您可能需要添加类似的内容

    while (gtk_events_pending ()) {
      gtk_main_iteration_do (FALSE);
}

That is, to let GTK process the pending events (like drawing the UI). 也就是说,让GTK处理未决事件(例如绘制UI)。 I suppose you are processing the output of ffmpeg with g_io_add_watch or similar. 我想您正在用g_io_add_watch或类似的东西处理ffmpeg的输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM