Sponsored Content
Top Forums UNIX for Advanced & Expert Users motif application crashes while calling XtDestroyWidget Post 302449383 by sanushchacko on Monday 30th of August 2010 11:57:00 AM
Old 08-30-2010
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
 

10 More Discussions You Might Find Interesting

1. Programming

Motif resources

I am very glad to be a member of you. where can i look for the resource programe examples about motif? please help me!Thanks a lot. (3 Replies)
Discussion started by: q30
3 Replies

2. Programming

Motif

Do you think that Motif programming is old...should I learn it... (3 Replies)
Discussion started by: CreamHarry
3 Replies

3. Programming

Motif - RedHat 7.3

Can somebody help me... I have insalled RedHat 7.3 on my computer and there is motif 2.x and i want to compile a cource code but it doesn't work it says Xm/PushB.h not found..something like that.. I'm trying like this : gcc -o x x.c -lXm -lXt -lX11 pleas help me (3 Replies)
Discussion started by: CreamHarry
3 Replies

4. Programming

motif help

Hi everyone, I am new in motif programming and I want to learn how to program it. I use Fedora core 3 and every time I compile the program, there are always some errors appear. One of the errors said that I do not have the Xm/xxxx.h However, I do not know precisely how to install header files. I... (0 Replies)
Discussion started by: qqq
0 Replies

5. HP-UX

motif reqired for hp-ux 11.11

hello everyone, where can i download motif compatible with HP-UX 11.11.which motif version i have to use. can i use openmotif 2.3 for HP-UX 11.11. pls somebody suggest a solution .it's very urgent. any help appreciated. with regards, Srini (0 Replies)
Discussion started by: mannam srinivas
0 Replies

6. Programming

Application crashes in FreeBSD 7.1 while working ok in FreeBSD 6.3

Hello there, My mulithreaded application (which is too large to represent the source code here) is crashing after installing FreeBSD 7.1-RELEASE/amd64. It worked properly on others machines (Dual Cores with 4GB of RAM - FreeBSD 6.2-RELEASE/i386). The current machine has 2x Core 2 Duo... (1 Reply)
Discussion started by: Seenquev
1 Replies

7. Solaris

application Crashes on memset ?? any suggestions

Hi All, we have an application that is written in 'C' programming to connects to various servers in the organization. The bellow code establish a TCP connection to connect to the remote servers. the application works perfectly ok, but, after some time the entire process get's crashed and... (2 Replies)
Discussion started by: sudharma
2 Replies

8. Solaris

Motif 2.1 migration from Motif 1.2

An application was getting built using Motif 1.2 that used come along Solaris 6 OS for compiling and linking. Application is run using Motif 2.1 on Solaris 10 and it is working fine. Application compilation and linking is working fine on Solaris 10 with Motif 2.1.0 but running the application... (0 Replies)
Discussion started by: shafi2all
0 Replies

9. Programming

Program crashes on calling __libc_msgrcv()

Hi, I am a newbie to linux programming. I have implemented msgqueue in C. msgrcv() call at the client end is as below: msgrcv( msgqid, msgptr, msgsize, msgtype, 0 ); My program works fine when msgrcv () from /lib/libc.so.6 is called. However it crashes when __libc_msgrcv() is called. ... (3 Replies)
Discussion started by: praasanna
3 Replies

10. Programming

Motif Application will not refresh

I have a Motif Application created with XtVaAppInitialize. I have two field widgets, created with XmCreateTextField. Now when I programmatically change the data in any of the two fields, the widgets don't get refreshed, only after a mouse over. I have tried anything, from including the "xrefresh"... (4 Replies)
Discussion started by: JenniferKuiper
4 Replies
XtCreateWidget(3)						   XT FUNCTIONS 						 XtCreateWidget(3)

NAME
XtCreateWidget, XtVaCreateWidget, XtCreateManagedWidget, XtVaCreateManagedWidget, XtDestroyWidget - create and destroy widgets SYNTAX
Widget XtCreateWidget(String name, WidgetClass widget_class, Widget parent, ArgList args, Cardinal num_args); Widget XtVaCreateWidget(String name, WidgetClass widget_class, Widget parent, ...); Widget XtCreateManagedWidget(String name, WidgetClass widget_class, Widget parent, ArgList args, Cardinal num_args); Widget XtVaCreateManagedWidget(String name, WidgetClass widget_class, Widget parent, ...); void XtDestroyWidget(Widget w); ARGUMENTS
args Specifies the argument list to override the resource defaults. name Specifies the resource name for the created widget, which is used for retrieving resources and, for that reason, should not be the same as any other widget that is a child of same parent. num_args Specifies the number of arguments in the argument list. parent Specifies the parent widget. w Specifies the widget. widget_class Specifies the widget class pointer for the created widget. ... Specifies the variable argument list to override the resource defaults. DESCRIPTION
The XtCreateWidget function performs much of the boilerplate operations of widget creation: o Checks to see if the class_initialize procedure has been called for this class and for all superclasses and, if not, calls those nec- essary in a superclass-to-subclass order. o Allocates memory for the widget instance. o If the parent is a subclass of constraintWidgetClass, it allocates memory for the parent's constraints and stores the address of this memory into the constraints field. o Initializes the core nonresource data fields (for example, parent and visible). o Initializes the resource fields (for example, background_pixel) by using the resource lists specified for this class and all super- classes. o If the parent is a subclass of constraintWidgetClass, it initializes the resource fields of the constraints record by using the con- straint resource list specified for the parent's class and all superclasses up to constraintWidgetClass. o Calls the initialize procedures for the widget by starting at the Core initialize procedure on down to the widget's initialize proce- dure. o If the parent is a subclass of compositeWidgetClass, it puts the widget into its parent's children list by calling its parent's insert_child procedure. For further information, see Section 3.5. o If the parent is a subclass of constraintWidgetClass, it calls the constraint initialize procedures, starting at constraintWidgetClass on down to the parent's constraint initialize procedure. Note that you can determine the number of arguments in an argument list by using the XtNumber macro. For further information, see Section 11.1. The XtCreateManagedWidget function is a convenience routine that calls XtCreateWidget and XtManageChild. The XtDestroyWidget function provides the only method of destroying a widget, including widgets that need to destroy themselves. It can be called at any time, including from an application callback routine of the widget being destroyed. This requires a two-phase destroy process in order to avoid dangling references to destroyed widgets. In phase one, XtDestroyWidget performs the following: o If the being_destroyed field of the widget is True, it returns immediately. o Recursively descends the widget tree and sets the being_destroyed field to True for the widget and all children. o Adds the widget to a list of widgets (the destroy list) that should be destroyed when it is safe to do so. Entries on the destroy list satisfy the invariant that if w2 occurs after w1 on the destroy list then w2 is not a descendent of w1. (A descendant refers to both normal and pop-up children.) Phase two occurs when all procedures that should execute as a result of the current event have been called (including all procedures regis- tered with the event and translation managers), that is, when the current invocation of XtDispatchEvent is about to return or immediately if not in XtDispatchEvent. In phase two, XtDestroyWidget performs the following on each entry in the destroy list: o Calls the destroy callback procedures registered on the widget (and all descendants) in post-order (it calls children callbacks before parent callbacks). o If the widget's parent is a subclass of compositeWidgetClass and if the parent is not being destroyed, it calls XtUnmanageChild on the widget and then calls the widget's parent's delete_child procedure (see Section 3.4). o If the widget's parent is a subclass of constraintWidgetClass, it calls the constraint destroy procedure for the parent, then the par- ent's superclass, until finally it calls the constraint destroy procedure for constraintWidgetClass. o Calls the destroy methods for the widget (and all descendants) in post-order. For each such widget, it calls the destroy procedure declared in the widget class, then the destroy procedure declared in its superclass, until finally it calls the destroy procedure declared in the Core class record. o Calls XDestroyWindow if the widget is realized (that is, has an X window). The server recursively destroys all descendant windows. o Recursively descends the tree and deallocates all pop-up widgets, constraint records, callback lists and, if the widget is a subclass of compositeWidgetClass, children. SEE ALSO
XtAppCreateShell(3), XtCreatePopupShell(3) X Toolkit Intrinsics - C Language Interface Xlib - C Language X Interface X Version 11 libXt 1.1.3 XtCreateWidget(3)
All times are GMT -4. The time now is 05:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy