Child process receives parent's SIGINT

前端 未结 2 1677
孤街浪徒
孤街浪徒 2020-11-27 20:34

I have one simple program that\'s using Qt Framework. It uses QProcess to execute RAR and compress some files. In my program I am catching SIGINT and doing som

2条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 20:48

    What are you doing in your handler? There are only certain Qt functions that you can call safely from a unix signal handler. This page in the documentation identifies what ones they are.

    The main problem is that the handler will execute outside of the main Qt event thread. That page also proposes a method to deal with this. I prefer getting the handler to "post" a custom event to the application and handle it that way. I posted an answer describing how to implement custom events here.

提交回复
热议问题