motif application crashes while calling XtDestroyWidget

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

3 posts / 0 new
Last post
motif application crashes while calling XtDestroyWidget

 

Hi All,
We have a 32bit Motif Gui application. Now we ported the application from Solaris to Linux and the system is crashing very frequently. On our analysis we could find that this issue happened when we are closing the forms in our application. When the forms are closed we will delete the forms and will call the function XtDestroyWidget() to remove the widgets. We ran a purify for the application and we could found that the Stack Array Bounds Read (SBR) is happening when we close the form.

I had downloaded a sample motif program from the internet which is using XtDestroyWidget() to destroy the object. When i ran purify for this sample program also, i could found the same SBR.

SBR: Stack array bounds read (54 times):
* This is occurring while in:
XtDispatchEvent [libXt.so.4]
RemoveAllPMgr [libXm.so.3]
XtCallCallbackList [libXt.so.4]
XtPhase2Destroy [libXt.so.4]
_XtDoPhase2Destroy [libXt.so.4]
XtDispatchEvent [libXt.so.4]
XtAppMainLoop [libXt.so.4]
main [popup.cc:49]
_start [crt1.o]
* Reading 4 bytes from 0xffbfe4f0.
* Frame pointer 0xffbfe4d0
* Address 0xffbfe4f0 is 32 bytes above stack pointer in function XtCallCallbackList.

This SBR is happening in the XtAppMainLoop(). From these facts i assume that this SBR is a common one and related to motif rather than to our application.

Can you please add some thoughts to the following questions.
1) Why SBR is happening when we use XtDestroyWidget(). Is this SBR a severe one.

2) I had removed the XtDestroyWidget and used XtUnrealizeWidget(). This will help me to remove the SBR and hence crash is not happening. Also all normal forms will be removed normally. But the problem i am facing in this approach is the POP_UP forms are NOT removed in this method. Can any one please suggest a work around for removing POP_UP forms also other than the HIDE option.

It will be very helpful for me if anyone can answer or add some thoughts for this issue.

Thanks in advance,
Sanush Chacko

I would suggest you compile

 

I would suggest you compile your own OpenMotif from CVS and use unstripped debug version when you run it with DDD or Valgrid.
In this way you will know exactly where does Motif break and you can report a bug with a line number in the Motif source code.

In my software I never destroy widgets (and I am developing it for 18 years), as memory overhead of the widget is mostly irrelevant, compared to other resources.
So my 150K source lines makes about 6000 widgets, binary size of 1.3MB, resulting in 35MB runtime size, most of which are libraries and memory I allocate.
Startup time (with creation of all widgets) is approximately one second (mostly disk bound, as it needs to read libraries and icons).

So I think your shortcut fix with XtUnrealizeWidget() is OK.

Unless your application is very special and it needs to run for years without closing down, in a very memory tight situation.

 

Hi , Thanks for your

 

Hi ,

Thanks for your reply.
We had implemeted the usage of XtUnrealizeWidget and removal of XtDestroyWidget in our application and performed trail run of the system in the Production. The system is Not crashing now. Also the memory growth is comparably very low.

Regards,
Sanush.