It would be easier if you had sent a working example such as the
one attached.

On my system it produces this output in both cases :
# dell: {34} bridoux
# Status1 is XtCallbackHasNone
# Status2 is XtCallbackHasSome

Does my example produce the wrong results on your system ?

If your system has a problem with this kind of application behaving
differently with or without compiler optimisation, then I'd suspect
the compiler.

        Danny


On Wed, 2004-10-06 at 18:26, BRIDOUX Philippe IC wrote:
> Hi everybody,
> 
> I have the following code:
> 
> XmTextField Widget w;
> 
> Status1 = XtHasCallback(w, XmNactivateCallback);
> XtAddCallback(w, XmNactivateCallback, Fct_cbk, cltcbk);
> Status2 = XtHasCallback(w, XmNactivateCallback);
> 
> When I compile in DEBUG mode and I execute, the result is :
> Status1 is XtCallbackHasNone (list is here but empty)
> Status2 is XtCallbackHasSome (list is here whth one element)
> 
> When I compile in OPTIMIZED mode, the result is very different :
> Status1 is XtCallbackNoList (no list callback in the widget)
> Message from lesstif : Warning : cannot find callback list in XtAddcallback
> Status2 is XtCallbackNoList (no list callback in the widget)
> 
> 
> So my questions are :
> 1 - Why do I have two behaviours between debut et optimized mode ?
> 2 - Does it exist a patch to correct this problem ? How can I obtain it
> 
> my OS is FEDORA 2.24 with lesstif 0.93.36-4 and Xfree86 4.3.0-42
> 
> Philippe BRIDOUX
> INTERCONTROLE DIUS/GSIX
> T�l :33 (0)4 42 17 36 43 - Fax : 33 (0)4 42 17 36 03
> [EMAIL PROTECTED]
> 
> 
> 
> -------------------------------------------------------
> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
> Use IT products in your business? Tell us what you think of them. Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
> http://productguide.itmanagersjournal.com/guidepromo.tmpl
> _______________________________________________
> Lesstif-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/lesstif-discuss
-- 
Danny Backx - danny.backx-at-planetinternet.be    http://up.to/danny.backx
/*
 * When I compile in DEBUG mode and I execute, the result is :
 * Status1 is XtCallbackHasNone (list is here but empty)
 * Status2 is XtCallbackHasSome (list is here whth one element)
 *
 * When I compile in OPTIMIZED mode, the result is very different :
 * Status1 is XtCallbackNoList (no list callback in the widget)
 * Message from lesstif : Warning : cannot find callback list in XtAddcallback
 * Status2 is XtCallbackNoList (no list callback in the widget)
 */
#include <Xm/Xm.h>
#include <Xm/List.h>
#include <stdio.h>

Widget toplevel, shell, list;

void Fct_cbk(Widget w, XtPointer client, XtPointer call)
{
	fprintf(stderr, "Yow!\n");
}

int
main(int argc, char **argv)
{
	Widget w;
	Dimension height;
	Position y;

	XtAppContext app;

	XmString items[3];
	XtCallbackStatus	Status1, Status2;

	toplevel = XtVaAppInitialize(&app, "Text", NULL, 0, &argc, argv, NULL, NULL);

	w = XmCreateTextField(toplevel, "tf", NULL, 0);
	XtManageChild(w);

	Status1 = XtHasCallbacks(w, XmNactivateCallback);
	fprintf(stderr, "Status1 is %s\n",
			(Status1 == XtCallbackHasNone) ? "XtCallbackHasNone" :
			(Status1 == XtCallbackHasSome) ? "XtCallbackHasSome" :
			(Status1 == XtCallbackNoList) ? "XtCallbackNoList" :
			"??");
	XtAddCallback(w, XmNactivateCallback, Fct_cbk, NULL);
	Status2 = XtHasCallbacks(w, XmNactivateCallback);
	fprintf(stderr, "Status2 is %s\n",
			(Status2 == XtCallbackHasNone) ? "XtCallbackHasNone" :
			(Status2 == XtCallbackHasSome) ? "XtCallbackHasSome" :
			(Status2 == XtCallbackNoList) ? "XtCallbackNoList" :
			"??");

	XtRealizeWidget(toplevel);

	XtAppMainLoop(app);
}

Reply via email to