ApCreateModule() bug

I have a photon app that was written long ago by a programmer that is no
longer available.

There is a code snipette that pops up a dialog. It works fine the first
time through but crashes the app (SIGSEGV at an invalid address according to
the link map) the second time you try to execute it. Here is the code:

// realize sub menu
ApCreateModule( ABM_subMenuDial, parentWgt, 0 );

// set menu dialog title
PtSetArg( &args[0], Pt_ARG_WINDOW_TITLE, menuTitle, 0 );
PtSetResources( ABW_subMenuDial, 1, args );

// set sub menu list items
PtSetArg( &args[0], Pt_ARG_ITEMS, menuItems, i );
PtSetResources( ABW_subMenuList, 1, args );

I noticed that ABM_subMenuDial appears to be valid on each invocation of the
code. I notice that ABW_subMenuDial is NULL both times when the code is
begun. But on the first invocation the ABW appears to get filled in by the
ApCreateModule() call. On the second invocation the ABW does NOT get
initialized by the ApCreateModule() call. I’m certain that it’s crashing
because ABW-subMenuDial is NULL when it goes to set the resources for the
window title.

Why does ABW_subMenuDial get initialized only the first time through
ApCreateModule()?

How do I fix it?

“Bill Caroselli (Q-TPS)” <QTPS@earthlink.net> wrote:

I have a photon app that was written long ago by a programmer that is no
longer available.

There is a code snipette that pops up a dialog. It works fine the first
time through but crashes the app (SIGSEGV at an invalid address according to
the link map) the second time you try to execute it. Here is the code:

// realize sub menu
ApCreateModule( ABM_subMenuDial, parentWgt, 0 );

// set menu dialog title
PtSetArg( &args[0], Pt_ARG_WINDOW_TITLE, menuTitle, 0 );
PtSetResources( ABW_subMenuDial, 1, args );

// set sub menu list items
PtSetArg( &args[0], Pt_ARG_ITEMS, menuItems, i );
PtSetResources( ABW_subMenuList, 1, args );

I noticed that ABM_subMenuDial appears to be valid on each invocation of the
code. I notice that ABW_subMenuDial is NULL both times when the code is
begun. But on the first invocation the ABW appears to get filled in by the
ApCreateModule() call. On the second invocation the ABW does NOT get
initialized by the ApCreateModule() call. I’m certain that it’s crashing
because ABW-subMenuDial is NULL when it goes to set the resources for the
window title.

Why does ABW_subMenuDial get initialized only the first time through
ApCreateModule()?

Because ApCreateModule() fails?

Does the dialog actually get displayed? What does ApCreateModule() return?

Does the dialog have a setup function?



\

Wojtek Lerch QNX Software Systems Ltd.