unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#22787: [PATCH] Allocate glyph matrices for the initial frame
@ 2016-02-24  6:32 Chris Feng
  2016-02-24  8:04 ` martin rudalics
  2016-02-24 17:25 ` Eli Zaretskii
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Feng @ 2016-02-24  6:32 UTC (permalink / raw)
  To: 22787

After bd4de70f the initial frame is created without the glyph matrices
allocated.  As a result Emacs in batch/daemon mode would crash when evaluating
certain functions (e.g. line-pixel-height, window-text-pixel-size).


* src/frame.c (make_initial_frame): Allocate glyph matrices.

* src/dispnew.c (clear_glyph_matrix_rows): matrix->nrows can be 0.
---
 src/dispnew.c | 2 +-
 src/frame.c   | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/dispnew.c b/src/dispnew.c
index 433a6e9..f96db30 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -683,7 +683,7 @@ void
 clear_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end)
 {
   eassert (start <= end);
-  eassert (start >= 0 && start < matrix->nrows);
+  eassert (start >= 0 && start <= matrix->nrows);
   eassert (end >= 0 && end <= matrix->nrows);

   for (; start < end; ++start)
diff --git a/src/frame.c b/src/frame.c
index 8c86afe..4f61332 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -867,6 +867,9 @@ make_initial_frame (void)
   /* The default value of menu-bar-mode is t.  */
   set_menu_bar_lines (f, make_number (1), Qnil);

+  /* Allocate glyph matrices.  */
+  adjust_frame_glyphs (f);
+
   if (!noninteractive)
     init_frame_faces (f);

-- 
2.7.0





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#22787: [PATCH] Allocate glyph matrices for the initial frame
  2016-02-24  6:32 bug#22787: [PATCH] Allocate glyph matrices for the initial frame Chris Feng
@ 2016-02-24  8:04 ` martin rudalics
  2016-02-24 17:25 ` Eli Zaretskii
  1 sibling, 0 replies; 4+ messages in thread
From: martin rudalics @ 2016-02-24  8:04 UTC (permalink / raw)
  To: Chris Feng, 22787

 > After bd4de70f the initial frame is created without the glyph matrices
 > allocated.  As a result Emacs in batch/daemon mode would crash when evaluating
 > certain functions (e.g. line-pixel-height, window-text-pixel-size).
 >
 >
 > * src/frame.c (make_initial_frame): Allocate glyph matrices.
 >
 > * src/dispnew.c (clear_glyph_matrix_rows): matrix->nrows can be 0.

Installed as tiny change on the emacs-25 branch.  Please have a look.

Thank you very much, martin





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#22787: [PATCH] Allocate glyph matrices for the initial frame
  2016-02-24  6:32 bug#22787: [PATCH] Allocate glyph matrices for the initial frame Chris Feng
  2016-02-24  8:04 ` martin rudalics
@ 2016-02-24 17:25 ` Eli Zaretskii
  2016-02-25  1:38   ` Chris Feng
  1 sibling, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2016-02-24 17:25 UTC (permalink / raw)
  To: Chris Feng; +Cc: 22787

> Date: Wed, 24 Feb 2016 14:32:17 +0800
> From: Chris Feng <chris.w.feng@gmail.com>
> 
> After bd4de70f the initial frame is created without the glyph matrices
> allocated.  As a result Emacs in batch/daemon mode would crash when evaluating
> certain functions (e.g. line-pixel-height, window-text-pixel-size).

Thanks, but can you explain this part:

>  clear_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end)
>  {
>    eassert (start <= end);
> -  eassert (start >= 0 && start < matrix->nrows);
> +  eassert (start >= 0 && start <= matrix->nrows);

If this is for the case that both start and matrix->nrows are zero,
please test that case separately.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#22787: [PATCH] Allocate glyph matrices for the initial frame
  2016-02-24 17:25 ` Eli Zaretskii
@ 2016-02-25  1:38   ` Chris Feng
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Feng @ 2016-02-25  1:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 22787

>> After bd4de70f the initial frame is created without the glyph matrices
>> allocated.  As a result Emacs in batch/daemon mode would crash when evaluating
>> certain functions (e.g. line-pixel-height, window-text-pixel-size).
>
> Thanks, but can you explain this part:
>
>>  clear_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end)
>>  {
>>    eassert (start <= end);
>> -  eassert (start >= 0 && start < matrix->nrows);
>> +  eassert (start >= 0 && start <= matrix->nrows);
>
> If this is for the case that both start and matrix->nrows are zero,
> please test that case separately.

Thanks.  I've just pushed a commit to fix this.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-25  1:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-24  6:32 bug#22787: [PATCH] Allocate glyph matrices for the initial frame Chris Feng
2016-02-24  8:04 ` martin rudalics
2016-02-24 17:25 ` Eli Zaretskii
2016-02-25  1:38   ` Chris Feng

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).