I use Qt4.8 in linux. The QPluginLoader for load plugins. If any plugin is crashed, then application crashed too. How to avoid crashing app?
2 Answers
I'm not certain that you can armor your application against a seg-fault within a loaded library. If you can move the functionality in that library into a service communicating via a local socket or your favorite IPC method
then you can simply handle the failure to communicate with the service.
EDIT
I did a little looking around to see if it is possible to catch SIGSEGV
, and learned that there are software libraries that attempt to do this very thing.
- GNU ships libsigsegv
- There is also a SO question about a similar library segvcatch for the c++ users amongst us: C++: Is using segvcatch safe? I tried a quick example of this on my OSX box and it did not work. YMMV.
So let's change 'cannot' to 'should not'.

- 1
- 1

- 1,347
- 1
- 11
- 27
A plugin is your application: there's no separation of any sort there. If a plugin crashes, it is your process that crashes. That's what a plugin is.
Plugins are just one way of designing modular software systems, though. Nobody forces you to use them. You're free to compartmentalize modules in their own processes, using an IPC library to communicate between the component processes.

- 95,931
- 16
- 151
- 313