BadWindow thread (jumping to the front :)

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

Questions about motif? Contact us

3 posts / 0 new
Last post
BadWindow thread (jumping to the front :)

Submitted by Anonymous on Fri, 07/27/2001 - 00:48. Developers
Hi, I just posted this as a follow up to the BadWindow thread started by saji_r a month ago... but I was worried that maybe some of you gurus wouldn`t see it way back in the queue there, so I`m posting it again up here at the top so you can`t miss it )

Don

I am having the same problem that SAJI_R is having.
The error message I get is

X Error of failed request BadWindow (invalid Window parameter)
Major opcode of failed request 19 (X_DeleteProperty)
Resource id in failed request 0x0
Serial number of failed request 407
Current serial number in output stream 413

I am using RH7.1 with openmotif 2.1.30-8. I also experienced
this problem with 2.1.30-4_MLI. I have been using this exact
same code with RH6.2 (although I can`t tell you the version
of motif or lesstif I was using) without a problem.

The line of code that this happens on is

m_wMainPanel = XtVaCreateManagedWidget( "MainPanel",
xmFormWidgetClass,
topWidget,
NULL );

topWidget is not a null pointer, it is 0x815cad0. Does anyone
know how I can track down how this Widget gets turned into a Bad
Window? Does it have to be realized first or something?

The interesting thing is if I switch this widget to be an
Xaw3d formWidgetClass, there is no problem. However, then the
next time I touch the motif library with this line the same
kind of error occurs

Widget wPopupPanel = XtVaCreateManagedWidget( "PopupPanel",
xmRowColumnWidgetClass,
m_wMainPanel,
NULL );

Again, m_wMainPanel looks like a very valid pointer from what
I can see under gdb.

I freely admit that I may be doing something that is improper and
for some reason have been getting away with it for a long time...
but I have no idea where to start on figuring out where to go
from here. Any advice would be much appreciated!
(I would really really hate to have to recode everything in
Xaw3d ( )

Don Murray
donm@cs.ubc.ca

Anonymous

I`m going to reply to my own message. I`ve been trying to isolate more closely what I could be doing that is causing this problem. My guess is that it could have to do with the odd way I initialize and open the display. I do it this way because I want to be able to get a colormap from the display before I create my top level widget.... this code has been removed but the slightly odd way in which I start up in still there. I`m pasting the code below so many someone can spot the stupidity I am doing. The program dies on the line after it prints out "I`m about to die". Any ideas would be great!!

Don

// System includes
#include
#include
#include
#include
#include
#include

// System includes
#include
#include

// X includes
#include
#include

// Motif includes
#include
#include

// Fallback resources
static String fallbackResources[] =
{
"*background gray",
"*foreground black",
NULL
};

void
main( int argc, char **argv )
{
// Init top level
XtToolkitInitialize();
XtAppContext app = XtCreateApplicationContext();
Display* display = XtOpenDisplay( app,
NULL,
"XTest",
"XTest",
NULL, 0,
&argc, argv );

if ( !display )
{
fprintf( stderr, "Could not open display `%s`
",
getenv("DISPLAY") );
exit( 1 );
}

Widget top = XtVaAppCreateShell( "XTest",
"XTest",
applicationShellWidgetClass,
display,
NULL );

printf( "I`m about to die
" );
Widget wMainPanel = XtVaCreateManagedWidget( "MainPanel",
xmFormWidgetClass,
top,
NULL );
printf( "I should be dead
" );

XtRealizeWidget( top );
XtAppMainLoop( app );
}

Anonymous

Replying to myself again, this is a bad habit.

So, I wanted to post my latest test code. Again, I`m using RH7.1. When I was using openmotif 2.1.30-8 this code generates a `badwindow` error when I try to create the xmFormWidgetClass. I have now confirmed that if I create an Xaw3d formWidgetClass I get no problem. Now I have switched to using Lesstif 0.92.32-3 and also have no problem,
so I guess I`ll stick with lesstif for now.

But if anyone had any ideas, I would of course be greatful, even if its just for the knowledge gain.

Thanks, Don

That code again

// System includes
#include
#include

// X includes
#include
#include

// Xaw3d includes
#include

// Motif includes
#include

#define USE_MOTIF

void
main( int argc, char **argv )
{
// Init top level
XtToolkitInitialize();
XtAppContext app = XtCreateApplicationContext();
Display* display = XtOpenDisplay( app,
NULL,
"XTest",
"XTest",
NULL, 0,
&argc, argv );

if ( !display )
{
fprintf( stderr, "Could not open display `%s`
",
getenv("DISPLAY") );
exit( 1 );
}

Widget top = XtVaAppCreateShell( "XTest",
"XTest",
applicationShellWidgetClass,
display,
NULL );

printf( "I`m about to die
" );

#ifdef USE_MOTIF
Widget wMainPanel = XtVaCreateManagedWidget( "MainPanel",
xmFormWidgetClass,
top,
XtNheight, 100,
XtNwidth, 100,
NULL );
#else
Widget wMainPanel = XtVaCreateManagedWidget( "MainPanel",
formWidgetClass,
top,
XtNheight, 100,
XtNwidth, 100,
NULL );
#endif

printf( "I should be dead
" );

XtRealizeWidget( top );
XtAppMainLoop( app );
}