[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2408.0. "ACCESS-VIOLATION in DwtFetchWidget, multiply displays" by SUOSW4::GEISELHART () Thu Mar 08 1990 04:04

Hey, I've got a problem with Fetch Widgets.

I have more than one display, in every display I have an ApplicationShell, and
a mainwindow in which I want to Fetch the Widgets (a menubar with some Push/
Buttons). I create the Display and the Parent and than fetch the widgets and
everything works fine. Than I have to destroy all the widgets in one display.
I do this with XtUnrealize, Xtdestroy and in the end Xtclosedisplay. After
this, when I try to open a new display, create new widgets and than fetch
the widgets from the uid-file again, the story ends with ACCESS-VIOLATION in
DwtFetchWidget. All the other widgets in the display , which I created myself,
not using uil work, but I can't fetch any from the uilfile. For creating the
display and the widgets I use the same modul at everytime.

..... some code from creating the widgets  ......

static          DRMCount        regnum = 2;

static          DRMRegisterArg  regvec[] = {
                                {"button_activate",(caddr_t)button_activate},
                                {"widget_create",(caddr_t)widget_create},
                                };



   if (DwtOpenHierarchy (1,vec,NULL,&s_DRMHierarchy) != DRMSuccess) {
        printf("can't open hierarchy");
        exit(BAD);
        };

   DwtRegisterDRMNames (regvec, regnum);
 

   if (DwtFetchWidget (s_DRMHierarchy, "bild_menu",Rahmen[Bild].main,
                        &Rahmen[Bild].menu,&class) != DRMSuccess) {
                printf("can't fetch widget!");
                exit(BAD);
        };

   XtManageChild(Rahmen[Bild].main);
   XtManageChild(Rahmen[Bild].dvwidget);
   XtManageChild(Rahmen[Bild].menu);
   XtRealizeWidget(Rahmen[Bild].top);

.... and this is how I destroy the widgets ....
  
 destroy_bild(id3)
 int id3;
{XEvent event;

TscSetCurrentScreen(Rahmen[id3].screen);  .... this is a grafic tool command..
TscClose(Rahmen[id3].screen);
TscSetCurrentScreen(Rahmen[id3].lscreen);
TscClose(Rahmen[id3].lscreen);
XtUnRealizeWidget(Rahmen[id3].menu);
XtDestroyWidget(Rahmen[id3].menu);
XtDestroyWidget(Rahmen[id3].dvwidget);
XtDestroyWidget(Rahmen[id3].main);
XtDestroyWidget(Rahmen[id3].top);
XtCloseDisplay(Rahmen[id3].display);
XtUnRealizeWidget(Rahmen[id3].lmenu);
XtDestroyWidget(Rahmen[id3].lmenu);
XtDestroyWidget(Rahmen[id3].ldvwidget);
XtDestroyWidget(Rahmen[id3].lmain);
XtDestroyWidget(Rahmen[id3].ltop);
XtCloseDisplay(Rahmen[id3].ldisplay);
}

after I have done this I cant fetch the widgets like it worked before I deleted
one. At least I think DwtFetchWidget should not exit with AccessVilation! 

Can somebody Help??? 

Thank You, Bianca.
T.RTitleUserPersonal
Name
DateLines
2408.1Don't close the display ...KAOU35::DLEROUXThu Mar 08 1990 08:305
    
    Don't close the display and it will work.  I had the same problems a
    few weeks ago.  It seems that there is a bug in XtCloseDisplay.
    
    Dan
2408.2To be more specific...LEOVAX::TREGGIARIThu Mar 08 1990 09:0411
>    It seems that there is a bug in XtCloseDisplay.
 
The bug is not in XtCloseDisplay, but in the Intrinsics resource caching
mechanism, and occurs only if you get the same ID back for the old and
new Display.  I'm not sure how Xlib allocates Display IDs, but if it is
just the address of a data structure, you might be able to ensure different
IDs by allocating some piece of memory using XtMalloc of the size of an
X display data structure after closing the display and before creating the
new one.

Leo