blackberry / SDL

Simple DirectMedia Layer is an open-source, cross-platform multimedia library designed to provide a low level API.
GNU Lesser General Public License v2.1
86 stars 46 forks source link

Deadlock when using Blackberry Ads library #49

Open DanielUranga opened 11 years ago

DanielUranga commented 11 years ago

Im developing a NME (NME uses SDL as backend) extension to display native ads for my Blackberry 10 native app. Im able to compile my extension correctly but im getting a deadlock with this code:

char window_group_name[256];
snprintf(window_group_name, 256, "SDL-window-%d", getpid());

SDL_SysWMinfo sysInfo;
SDL_VERSION(&sysInfo.version);
screen_window_t screen_window = NULL;
int a = SDL_GetWMInfo(&sysInfo);

if(a>0)
{
    screen_window = sysInfo.window;
}

ad_banner = 0;
int ad_is_visible = 0;

if (BBADS_EOK != bbads_banner_create(&ad_banner, screen_window, window_group_name, BANNER_TEST_ZONE_ID))
{
    return;
}

The deadlock occurs when I call "bbads_banner_create", my app freezes and I have to kill it from Qde. I fail to find the cause of the problem, maybe is this a SDL bug or could find a way to solve from the SDL side?

DanielUranga commented 11 years ago

Forgot to mention, I had this same problem: http://supportforums.blackberry.com/t5/Native-Development/Playbook-version-ok-BB10-crashes-almost-immediately-before-main/td-p/2045601 and solved like he did.

And the SDL version I am using (the one that comes with NME) does not include sysInfo.mainWindow, maybe I should be using that instead of sysInfo.window?

jnicholl commented 11 years ago

Hmm. That's definitely worth trying, because if you have a version of SDL before dc65b20f638856d628e47ff4e1e6f55de43b922c (addition of sysInfo.mainWindow) but after 20c331e324ad5d58ef80c8352a760e2ac866747e (changing how window sizes are handled, which changes the top-level window) then the window handle you're passing is not the correct handle.