ApCreateModule fails

I am currently porting a photon application that was developed under QNX4.25 to QNX 6.3.2. It did not have any problems under QNX 4.25. Now that we have ported the code and began testing, ApCreateModule seems to randomly fail. There is a timer event runnin every 200 ms that sets the resource of some buttons, if this event is disabled, then ApCreateModule seems not to fail. I’ve tried to eliminate every thing that the timer event is doing, but it does not make a difference. I have even checked all the variables being fed to ApCreateModule when it fails. I have also searched everywhere, but it seems that no one has posted any information about what could cause ApCreateModule to fail.

I also checked the setup function that gets called as a result of ApCreateModule, it does not get executed.

Does anyone have any ideas about what else besides Null pointers and the setup function could cause ApCreateModule to fail?

BTW: I am using it to display a picture module inside of a pane.


when you say it fails, is it only the app that fails or the whole OS? Also what kind of graphics card are you running?
when your apps fails is pwm failing too? Does your app generate any core dump files after it fails?

The app itself does not fail, only the call to ApCreateModule. This is the scenario:

I have a small base window that contains a pane (ABW_wnd_pane). When the app is launched initially, the pane is loaded with a picture module containing some buttons, text fields and a timer. The timer is set to repeat every 200 ms. The timer’s sole purpose is to set the flags for Pt_GHOST & Pt_BLOCKED depending on the current user permissions read from a custom database. When the user clicks on a login button, the following code is executed:

PtClearWidget (ABW_wnd_pane);
ApCreateModule (ABM_cmdbar_login_pict, ABW_wnd_pane, NULL);
PtReRealizeWdiget (ABW_wnd_pane);

If you wait about 3 minutes after launching the app before clicking on the login, the above call to ApCreateModule fails and I am left with a base window and a blank ABW_wnd_pane. There is a default user logged in when the application starts up.

I did step the code using DDD, but since I do not have the photon source code I am not able to see what ApCreateModule does.

Since the app does not terminate when the call fails, no core dump is created.

try this.

PtClearWidget (ABW_wnd_pane);
PtSetParentWidget( ABW_wnd_pane);
ApCreateModule (ABM_cmdbar_login_pict, NULL, NULL);
PtReRealizeWdiget (ABW_wnd_pane);

I had a similar problem once (not identical)… As I remember it was that the parent did not have the flag Ph_WM_FOCUS or some other similar focus flag and when the child window was closed, the focus was given to the parent (which did not have that flag) and the app died. It was also from a migration from 4.25 to 6.3.2. But I think pwm also died.

Juan Manuel

Thanks for the suggestions, I will give them a try. I have also found that the memory for the widgets are becoming corrupt, this is probably due to another program that the GUI attaches to.

Finally found the problem. It turns out that we were calling ConnectAttach in more than one place. The second place (incorrect place), was passing in the previously obtained connection id instead of a channel id. This was causing the memory of the application to slowly become corrupted.

Thanks for the help!