Hi
When running licq with parameters like these:
licq -p qt-gui -p forwarder -- -- -e
it crashes inside getopt():
Licq Segmentation Violation Detected. Backtrace: licq(licq_handle_sigsegv+0x88) [0x80bf098] /lib/libc.so.6 [0x402c0dd8] /lib/libc.so.6(getopt+0x45) [0x4035e3d5] /usr/local/lib/licq/licq_qt-gui.so(_ZN8CLicqGuiC1EiPPc+0x36f) [0x4043b4cf] /usr/local/lib/licq/licq_qt-gui.so(LP_Main+0x3b) [0x4043a65b] /usr/local/lib/licq/licq_qt-gui.so(LP_Main_tep+0x1c) [0x4043a3ac] /lib/libpthread.so.0 [0x40159473] /lib/libc.so.6(__clone+0x44) [0x403757c4] Attempting to generate core file.
The problem is due to qt-gui saving argv and calling getopt() later, when the other plugin has already parsed its own parameters.
A possible fix is to create the main class instance from inside LP_Init(), the same way it is done in other plugins. This avoids the need to save argc and argv. Patch is attached.
If there is a reason to create the object in LP_Main(), the fix would be to set optind to 0 before calling getopt().
Marcelo
diff -ur qt-gui/src/licqgui.cpp qt-gui-fix/src/licqgui.cpp --- qt-gui/src/licqgui.cpp 2003-04-17 11:01:01.000000000 -0300 +++ qt-gui-fix/src/licqgui.cpp 2003-08-02 13:53:46.000000000 -0300 @@ -139,9 +139,6 @@ return desc; } -static int gui_argc = 0; -static char** gui_argv = NULL; - bool LP_Init(int argc, char **argv) { if (qApp != NULL) @@ -158,23 +155,16 @@ i--; } - // save for LP_Main (below) - gui_argc=argc; - gui_argv=argv; - return true; + licqQtGui = new CLicqGui(argc, argv); + return (licqQtGui != NULL); } int LP_Main(CICQDaemon *_licqDaemon) { - licqQtGui = new CLicqGui(gui_argc, gui_argv); - int nResult = licqQtGui->Run(_licqDaemon); licqQtGui->Shutdown(); - gui_argc = 0; - gui_argv = NULL; - return nResult; }