|  | @@ -423,12 +423,21 @@ void la_DestroyWindow(laWindow *wnd){
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      strSafeDestroy(&wnd->Title);
 |  |      strSafeDestroy(&wnd->Title);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    la_PrintUserList(wnd);
 | 
											
												
													
														|  | 
 |  | +    printf("----\n");
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      while (p = lstPopItem(&wnd->Panels)){ laDestroySinglePanel(p,1); }
 |  |      while (p = lstPopItem(&wnd->Panels)){ laDestroySinglePanel(p,1); }
 | 
											
												
													
														|  |      while (l = lstPopItem(&wnd->Layouts)){
 |  |      while (l = lstPopItem(&wnd->Layouts)){
 | 
											
												
													
														|  |          laDestroyBlocksRecursive(l->FirstBlock);
 |  |          laDestroyBlocksRecursive(l->FirstBlock);
 | 
											
												
													
														|  | 
 |  | +        la_PrintUserList(l);
 | 
											
												
													
														|  | 
 |  | +        printf("%x %s\n", l, l->ID->Ptr);
 | 
											
												
													
														|  |          strSafeDestroy(&l->ID);
 |  |          strSafeDestroy(&l->ID);
 | 
											
												
													
														|  |          memFree(l);
 |  |          memFree(l);
 | 
											
												
													
														|  | 
 |  | +        la_PrintUserList(wnd);
 | 
											
												
													
														|  | 
 |  | +        printf("----\n");
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | 
 |  | +    printf("----\n%x\n",wnd);
 | 
											
												
													
														|  | 
 |  | +    la_PrintUserList(wnd);
 | 
											
												
													
														|  |      la_DestroySystemWindow(wnd);
 |  |      la_DestroySystemWindow(wnd);
 | 
											
												
													
														|  |      lstRemoveItem(&MAIN.Windows, wnd);
 |  |      lstRemoveItem(&MAIN.Windows, wnd);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
										
											
												
													
														|  | @@ -2297,7 +2306,7 @@ int laStartWindow(laWindow *w){
 | 
											
												
													
														|  |      MAIN.CurrentWindow = w;
 |  |      MAIN.CurrentWindow = w;
 | 
											
												
													
														|  |      if(!w->CurrentLayout){
 |  |      if(!w->CurrentLayout){
 | 
											
												
													
														|  |          if(!w->Layouts.pFirst){laDesignLayout(w, "Empty Layout");}
 |  |          if(!w->Layouts.pFirst){laDesignLayout(w, "Empty Layout");}
 | 
											
												
													
														|  | -        w->CurrentLayout=w->Layouts.pFirst;
 |  | 
 | 
											
												
													
														|  | 
 |  | +        memAssignRef(w, &w->CurrentLayout, w->Layouts.pFirst);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |      laRedrawCurrentWindow();
 |  |      laRedrawCurrentWindow();
 | 
											
												
													
														|  |      laInvokeUi(0, "LA_window_operator", 0, w, 0, 0);
 |  |      laInvokeUi(0, "LA_window_operator", 0, w, 0, 0);
 | 
											
										
											
												
													
														|  | @@ -2348,11 +2357,11 @@ void laDestroyLayout(laWindow *w, laLayout* l){
 | 
											
												
													
														|  |      if((!l->Item.pPrev) && (!l->Item.pNext)) return;
 |  |      if((!l->Item.pPrev) && (!l->Item.pNext)) return;
 | 
											
												
													
														|  |      laDestroyBlocksRecursive(l->FirstBlock);
 |  |      laDestroyBlocksRecursive(l->FirstBlock);
 | 
											
												
													
														|  |      strSafeDestroy(&l->ID);
 |  |      strSafeDestroy(&l->ID);
 | 
											
												
													
														|  | -    if(w->CurrentLayout==l){ w->CurrentLayout=l->Item.pPrev?l->Item.pPrev:l->Item.pNext; }
 |  | 
 | 
											
												
													
														|  | 
 |  | +    if(w->CurrentLayout==l){ memAssignRef(w, &w->CurrentLayout, l->Item.pPrev?l->Item.pPrev:l->Item.pNext); }
 | 
											
												
													
														|  |      lstRemoveItem(&w->Layouts,l); memFree(l);
 |  |      lstRemoveItem(&w->Layouts,l); memFree(l);
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  laLayout *laDesignLayout(laWindow *w, char *Title){
 |  |  laLayout *laDesignLayout(laWindow *w, char *Title){
 | 
											
												
													
														|  | -    laLayout *l = memAcquireHyper(sizeof(laLayout));
 |  | 
 | 
											
												
													
														|  | 
 |  | +    laLayout *l = memAcquire(sizeof(laLayout));
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      l->FirstBlock = memAcquire(sizeof(laBlock));
 |  |      l->FirstBlock = memAcquire(sizeof(laBlock));
 | 
											
												
													
														|  |      la_AssignBlockPP(l->FirstBlock);
 |  |      la_AssignBlockPP(l->FirstBlock);
 | 
											
										
											
												
													
														|  | @@ -2360,7 +2369,7 @@ laLayout *laDesignLayout(laWindow *w, char *Title){
 | 
											
												
													
														|  |      lstAppendItem(&w->Layouts, l);
 |  |      lstAppendItem(&w->Layouts, l);
 | 
											
												
													
														|  |      strSafeSet(&l->ID, Title);
 |  |      strSafeSet(&l->ID, Title);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    w->CurrentLayout = l;
 |  | 
 | 
											
												
													
														|  | 
 |  | +    memAssignRef(w, &w->CurrentLayout, l);
 | 
											
												
													
														|  |      laRenameWindow(w, Title);
 |  |      laRenameWindow(w, Title);
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      return l;
 |  |      return l;
 |