Ignore:
Timestamp:
Aug 15, 2011 9:51:23 AM (13 years ago)
Author:
bennylp
Message:

Re #1327 (vidgui): fixed crash on Linux because SDL_Init() needs to be called prior to creating QApplication

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/vidgui/vidgui.cpp

    r3686 r3695  
    2020#include "vidwin.h" 
    2121 
     22#include <SDL.h> 
    2223#include <assert.h> 
    2324 
     
    575576int main(int argc, char *argv[]) 
    576577{ 
     578    /* At least on Linux, we have to initialize SDL video subsystem prior to 
     579     * creating/initializing QApplication, otherwise we'll segfault miserably 
     580     * in SDL_CreateWindow(). Here's a stack trace if you're interested: 
     581 
     582        Thread [7] (Suspended: Signal 'SIGSEGV' received. Description: Segmentation fault.) 
     583        13 XCreateIC() 
     584        12 SetupWindowData() 
     585        11 X11_CreateWindow() 
     586        10 SDL_CreateWindow() 
     587        .. 
     588     */ 
     589    if ( SDL_InitSubSystem(SDL_INIT_VIDEO) < 0 ) { 
     590        printf("Unable to init SDL: %s\n", SDL_GetError()); 
     591        return 1; 
     592    } 
     593 
    577594    QApplication app(argc, argv); 
     595 
    578596    MainWin win; 
    579597    win.show(); 
     
    584602    } 
    585603 
    586     /* Initialize our module to handle otherwise unhandled request */ 
    587     pjsip_endpt_register_module(pjsua_get_pjsip_endpt(), 
    588                                 &mod_default_handler); 
     604    /* We want to be registrar too! */ 
     605    if (pjsua_get_pjsip_endpt()) { 
     606        pjsip_endpt_register_module(pjsua_get_pjsip_endpt(), 
     607                                    &mod_default_handler); 
     608    } 
    589609 
    590610    return app.exec(); 
Note: See TracChangeset for help on using the changeset viewer.