XForms: URGENT: Unable to track Seg fault in fl_get_form_mouse()

Jathan W. Manley (jwmanley@mtu.edu)
Mon, 10 Nov 1997 12:20:44 -0500

To subscribers of the xforms list from "Jathan W. Manley" <jwmanley@mtu.edu> :

I am recieving a segmentation fault in fl_get_form_mouse.

This is a stack print from gdb.

#0 0xef5db618 in fl_get_form_mouse ()
#1 0xef5b2060 in do_interaction_step ()
#2 0xef5b2be0 in fl_treat_interaction_events ()
#3 0xef5b2c78 in fl_do_forms ()
#4 0x1dbdc in Interface::Start (this=0x76de0) at Interface.C:349
#5 0x192a8 in CheckersGame::Start (this=0x76de0) at CheckersGame.C:136
#6 0x21da4 in main (argc=1, argv=0xeffffafc) at Main.C:10

I have checked all the data members in my code. It draws the screen,
and as soon as the mouse enters the form I get the segmentation fault.
Can anyone tell me what might be happening?
I am using xforms .86 on Solaris. I have included the form definition
for refernce:

//******************************************************************************
void Interface::DrawScreen()
{
int i,j;
statusMessage = "";

//********** Define Gaming environment ***********************

mainWindow = fl_bgn_form(FL_FRAME_BOX,(53 * BSIZE + 216),
(53 * BSIZE+ 56));

fl_set_border_width(1);

theBoard = fl_bgn_group();

SetStatusBar();

SetToolBar();

SetMenus(); //Set up the pulldown Menus

fl_end_group();

fl_end_form();

theWindow = fl_show_form(mainWindow, FL_PLACE_MOUSE, FL_TRANSIENT,
"UltraCheckers 1.0");

SetInitialPixmaps();

fl_freeze_form(mainWindow);
fl_addto_form(mainWindow);
fl_set_border_width(3);
fl_addto_group(theBoard);

for(i = 0; i < BSIZE; i++)
for(j = 0; j < BSIZE; j++)
{
squares[i][j] = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 190 + j*53
,
53*(BSIZE-1) - i*53 + 30,
53,
53,"");
fl_set_object_callback(squares[i][j],ERF, 8*i + j);

if( (i + j) % 2 != 0)
{
fl_set_pixmapbutton_pixmap(squares[i][j], looks[0].lblank, 0);
fl_set_pixmapbutton_focus_outline(squares[i][j], FALSE);
}
else
fl_set_pixmapbutton_pixmap(squares[i][j], looks[0].dblank, 0);
}

fl_set_border_width(1);

fl_end_group();
// Turn Indicator...
turnIndicate = fl_add_pixmap(FL_NORMAL_PIXMAP, LEFT_EDGE + 5,
46, 53, 53, "");
fl_set_pixmap_pixmap(turnIndicate, looks[style].dblank, 0);

fl_end_form();
fl_unfreeze_form(mainWindow);
XFlush(fl_get_display());
}

//************************************************************
void Interface::SetStatusBar()
{
// The Status bar message Window
statusBar = fl_add_box(FL_DOWN_BOX, 190, BSIZE * 53 + 32, 424, 20,
statusMessage);
fl_set_object_color(statusBar, FL_WHITE, FL_BLACK);
fl_set_object_lsize(statusBar, FL_NORMAL_SIZE);
fl_set_object_lstyle(statusBar, FL_BOLD_STYLE);
fl_set_object_lalign(statusBar, FL_ALIGN_LEFT | FL_ALIGN_INSIDE);
}
//***************************************************************
void Interface::SetToolBar()
{
newButton = fl_add_button(FL_NORMAL_BUTTON, LEFT_EDGE, TOP_EDGE,
WIDTH,
HEIGHT, "New Game");
fl_set_object_callback(newButton, ERF, I_NEW);

loadButton = fl_add_button(FL_NORMAL_BUTTON, LEFT_EDGE, TOP_EDGE +
HEIGHT,
WIDTH, HEIGHT, "Load Game");
fl_set_object_callback(loadButton, ERF, I_LOAD);

saveButton = fl_add_button(FL_NORMAL_BUTTON, LEFT_EDGE,
TOP_EDGE + 2 * HEIGHT, WIDTH, HEIGHT,
"Save Game");
fl_set_object_callback(saveButton, ERF, I_SAVE);


undoButton = fl_add_button(FL_NORMAL_BUTTON, LEFT_EDGE,
TOP_EDGE + 3 * HEIGHT + SPACE, WIDTH, HEIGHT,
"Undo Move");
fl_set_object_callback(undoButton, ERF, I_UNDO);

replayButton = fl_add_button(FL_NORMAL_BUTTON, LEFT_EDGE,
TOP_EDGE + 4 * HEIGHT + SPACE, WIDTH,
HEIGHT, "Replay Moves");
fl_set_object_callback(replayButton, ERF, I_REPLAY);


hintButton = fl_add_button(FL_NORMAL_BUTTON, LEFT_EDGE,
TOP_EDGE + 5 * HEIGHT + 2 * SPACE, WIDTH,
HEIGHT, "Hint");
fl_set_object_callback(hintButton, ERF, I_HINT);


quitButton = fl_add_button(FL_NORMAL_BUTTON, LEFT_EDGE,
TOP_EDGE + 6 * HEIGHT + 3 * SPACE,
WIDTH, HEIGHT, "Quit");
fl_set_object_callback(quitButton, ERF, I_QUIT);
}
//*****************************************************************
void Interface::SetMenus()
{
fl_setpup_fontsize(FL_SMALL_SIZE);
fl_setpup_fontstyle(FL_NORMAL_STYLE);

//Create the SubMenus
lightPup = fl_newpup(theWindow);
fl_addtopup(lightPup, "%FPlayed by Human%r24%x21", Prefs);
fl_addtopup(lightPup, "Played by Computer%R24%x22%l");
fl_addtopup(lightPup, "Light Plays First%x23%r2");

darkPup = fl_newpup(theWindow);
fl_addtopup(darkPup, "%FPlayed by Human%R25%x11", Prefs);
fl_addtopup(darkPup, "Played by Computer%r25%x12%l|Dark Plays
First%R2%x13");

diffPup = fl_newpup(theWindow);
fl_addtopup(diffPup, "%FI know Pi to 127 decimal places.%x31%r3",
Prefs);
fl_addtopup(diffPup, "I know what pi is%x32%R3");
fl_addtopup(diffPup, "What was my name again?%x33%r3");

stylesPup = fl_newpup(theWindow);
fl_addtopup(stylesPup,"%FGranite%R4%x41|Tournament%r4%x42", Prefs);
fl_addtopup(stylesPup,"Pastel%r4%x43|Ocean%r4%x44");

prefPup = fl_newpup(theWindow);
fl_addtopup(prefPup,"%FDark Player%m|LightPlayer%m%l",Prefs, darkPup,
lightPup);
fl_addtopup(prefPup,"Difficulty%m%l|BoardStyle%m",diffPup, stylesPup);

filePup = fl_newpup(theWindow);
fl_addtopup(filePup, "%FNew Game...%x1|Load Game...%x2|Save
Game...%x3%l",
Menu);
fl_addtopup(filePup, "Load Scenario...%x4%l|Quit%x5");

editPup = fl_newpup(theWindow);
fl_addtopup(editPup, "%FUndo Move%x6|Replay Moves...%x7%l", Menu);
fl_addtopup(editPup, "Scenario Editor...%x8");


pullDownBox = fl_add_box(FL_BORDER_BOX,4, 4, 632, 22, "");

fileMenu = fl_add_menu(FL_PULLDOWN_MENU, 5, 5, 50, 20, "File");
fl_set_menu_popup(fileMenu, filePup);
fl_set_object_lalign(fileMenu, FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
fl_set_object_callback(fileMenu, ERF, I_DONOTHING);

editMenu = fl_add_menu(FL_PULLDOWN_MENU, 52, 5, 50, 20, "Edit");
fl_set_menu_popup(editMenu, editPup);
fl_set_object_lalign(editMenu, FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
fl_set_object_callback(editMenu, ERF, I_DONOTHING);

prefsMenu = fl_add_menu(FL_PULLDOWN_MENU, 104, 5, 75, 20,
"Preferences");
fl_set_menu_popup(prefsMenu,prefPup);
fl_set_object_lalign(prefsMenu, FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
fl_set_object_callback(prefsMenu, ERF, I_DONOTHING);
}
//***************************************************8
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/