Commit 287b3e94 authored by Jehan's avatar Jehan

Added some debug infos.

parent 95d595e4
......@@ -2788,6 +2788,7 @@ rxvt_init_vts( rxvt_t *r, int page, int profile )
if (page < 0 || page > LTAB(r) + 1)
return 0;
rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "rxvt_init_vts (r, %d)\n", page));
LTAB(r)++;
{
/*
......@@ -2799,17 +2800,23 @@ rxvt_init_vts( rxvt_t *r, int page, int profile )
if ((temp_vts_page = rxvt_malloc (sizeof (term_t))) == NULL)
{
LTAB(r)--;
rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "\tThe terminal allocation failed. Returning. Last tab is %d.\n", LTAB(r)));
return 0;
}
rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "\tA new terminal has been allocated.\n"));
if ((temp_vts = rxvt_realloc (r->vts, (LTAB (r) + 1) * sizeof (term_t*))) == NULL)
{
rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "\tThe terminal array's reallocation to (%d * sizeof (term_t*)) failed.\n", LTAB(r) + 1));
LTAB(r)--;
rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "\tLast tab is now %d.\n", LTAB(r)));
rxvt_free (temp_vts_page);
rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "\tPreviously allocated terminal freed. Returning.\n"));
return 0;
}
r->vts = temp_vts;
rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "\tThe terminal array has been reallocated to (%d * sizeof (term_t*)). The last tab is now %d.\n", LTAB(r) + 1, LTAB(r)));
if (page != LTAB (r))
MEMMOVE (r->vts[page + 1], r->vts[page], (LTAB(r) - page) * sizeof (term_t*));
......@@ -2965,6 +2972,7 @@ rxvt_init_vts( rxvt_t *r, int page, int profile )
void
rxvt_destroy_termwin( rxvt_t *r, int page )
{
rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "rxvt_destroy_termwin (r, %d)\n", page));
assert (page <= LTAB(r));
assert (PVTS(r, page)->tab_title);
......@@ -3000,6 +3008,7 @@ rxvt_destroy_termwin( rxvt_t *r, int page )
#endif
rxvt_free (PVTS(r, page));
rxvt_dbgmsg ((DBG_DEBUG, DBG_INIT, "\tThe terminal %d has been successfully freed.\n", page));
}
......
......@@ -587,10 +587,9 @@ struct term_t;
typedef struct
{
/*
* Index to vts. If it's -1, then this term_t structure is not used.
* Otherwise, it is used by pointer vts[vts_idx]. This is to improve destroy
* performance so that we only need to do (i = page..ltab) vts[i] = vts[i+1]
* instead of vterm[i] = vterm[i+1].
* Index to vts.
* This term_t can be accessed through pointer vts[vts_idx].
* It is also the order in the tabbar.
*/
short vts_idx;
......
......@@ -1395,9 +1395,9 @@ rxvt_append_page( rxvt_t* r, int profile,
assert( -1 != LVTS(r)->cmd_fd );
if (-1 == LVTS(r)->cmd_fd)
{
rxvt_destroy_termwin (r, LTAB(r));
rxvt_dbgmsg ((DBG_WARN, DBG_TABBAR,
"\tThe command failed.\n"));
rxvt_destroy_termwin (r, LTAB(r));
return;
}
rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR,"page %d's cmd_fd is %d\n", LTAB(r), LVTS(r)->cmd_fd));
......@@ -1509,6 +1509,7 @@ rxvt_remove_page (rxvt_t* r, short page)
/* update total number of tabs */
LTAB(r)--;
rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR, "\tThe last tab is %d.", LTAB(r)));
if (FVTAB(r) > page)
FVTAB(r)--;
......@@ -1526,7 +1527,11 @@ rxvt_remove_page (rxvt_t* r, short page)
{
term_t** temp_vts = rxvt_realloc (r->vts, (LTAB (r) + 1) * sizeof (term_t*));
if (temp_vts)
{
r->vts = temp_vts;
rxvt_dbgmsg ((DBG_DEBUG, DBG_TABBAR,
"\tThe tab array has been reallocated to (%d * sizeof (term_t*)).\n", LTAB(r) + 1));
}
else
rxvt_dbgmsg ((DBG_WARN, DBG_TABBAR,
"\tAfter removing a tab, the tab array could not be reallocated. If you see often this message, this can be a problem.\n"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment