all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* wrong behaviour of <struct frame>
@ 2010-12-02  8:54 alin soare
  2010-12-02  9:12 ` Jan Djärv
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: alin soare @ 2010-12-02  8:54 UTC (permalink / raw)
  To: emacs-devel

I defined within the struct frame an integer variable

int ct;

If I define it immediately after the menu_bar_vector, it is initialized
somewhere with the pointer value of Qnil. (&Qnil)

      Only the X toolkit version uses this.  */

   Lisp_Object menu_bar_vector;
+
+    int ct;


In this case, if I change the value f->ct, emacs crashes with segmentation
fault, generated by the garbage collector. Why , as time as I initialize a
variable defined by myself ?


-----------------------------------------

If I define it at the end of struct frame, id est immediately after the
fieldforeground_pixel,

/* All display backends seem to need these two pixel values. */
  unsigned long background_pixel;
  unsigned long foreground_pixel;
+
+    int ct;
}

everything works fine in that case.

I wish to ask you to suggest me if you can, what happens when I define the var.
'ct' inside the struct frame.



Alin.






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

* Re: wrong behaviour of <struct frame>
  2010-12-02  8:54 wrong behaviour of <struct frame> alin soare
@ 2010-12-02  9:12 ` Jan Djärv
  2010-12-02  9:14   ` Alin Soare
  2010-12-02  9:45 ` martin rudalics
  2010-12-02 13:14 ` Andreas Schwab
  2 siblings, 1 reply; 5+ messages in thread
From: Jan Djärv @ 2010-12-02  9:12 UTC (permalink / raw)
  To: alin soare; +Cc: emacs-devel

Read the comments:

   /* All Lisp_Object components must come first.
      That ensures they are all aligned normally.  */

and

   /* Beyond here, there should be no more Lisp_Object components.  */

Also see allocate_frame in alloc.c and make_frame in frame.c.

	Jan D.


alin soare skrev 2010-12-02 09.54:
> I defined within the struct frame an integer variable
>
> int ct;
>
> If I define it immediately after the menu_bar_vector, it is initialized
> somewhere with the pointer value of Qnil. (&Qnil)
>
>        Only the X toolkit version uses this.  */
>
>     Lisp_Object menu_bar_vector;
> +
> +    int ct;
>
>
> In this case, if I change the value f->ct, emacs crashes with segmentation
> fault, generated by the garbage collector. Why , as time as I initialize a
> variable defined by myself ?
>
>
> -----------------------------------------
>
> If I define it at the end of struct frame, id est immediately after the
> fieldforeground_pixel,
>
> /* All display backends seem to need these two pixel values. */
>    unsigned long background_pixel;
>    unsigned long foreground_pixel;
> +
> +    int ct;
> }
>
> everything works fine in that case.
>
> I wish to ask you to suggest me if you can, what happens when I define the var.
> 'ct' inside the struct frame.
>
>
>
> Alin.
>
>
>



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

* Re: wrong behaviour of <struct frame>
  2010-12-02  9:12 ` Jan Djärv
@ 2010-12-02  9:14   ` Alin Soare
  0 siblings, 0 replies; 5+ messages in thread
From: Alin Soare @ 2010-12-02  9:14 UTC (permalink / raw)
  To: Jan Djärv; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

>
>  /* All Lisp_Object components must come first.
>     That ensures they are all aligned normally.  */
>
> and
>
>  /* Beyond here, there should be no more Lisp_Object components.  */
>
> Also see allocate_frame in alloc.c and make_frame in frame.c.
>


Great!. Pfff, I did not see it :(.


Alin.

[-- Attachment #2: Type: text/html, Size: 539 bytes --]

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

* Re: wrong behaviour of <struct frame>
  2010-12-02  8:54 wrong behaviour of <struct frame> alin soare
  2010-12-02  9:12 ` Jan Djärv
@ 2010-12-02  9:45 ` martin rudalics
  2010-12-02 13:14 ` Andreas Schwab
  2 siblings, 0 replies; 5+ messages in thread
From: martin rudalics @ 2010-12-02  9:45 UTC (permalink / raw)
  To: alin soare; +Cc: emacs-devel

 > I wish to ask you to suggest me if you can, what happens when I define the var.
 > 'ct' inside the struct frame.

Lisp objects (objects handled by the GC) should appear above this line

   /* Beyond here, there should be no more Lisp_Object components.  */

and non-Lisp objects (objects not handled by the GC) below.

martin



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

* Re: wrong behaviour of <struct frame>
  2010-12-02  8:54 wrong behaviour of <struct frame> alin soare
  2010-12-02  9:12 ` Jan Djärv
  2010-12-02  9:45 ` martin rudalics
@ 2010-12-02 13:14 ` Andreas Schwab
  2 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2010-12-02 13:14 UTC (permalink / raw)
  To: alin soare; +Cc: emacs-devel

alin soare <as1789@gmail.com> writes:

> I defined within the struct frame an integer variable
>
> int ct;
>
> If I define it immediately after the menu_bar_vector, it is initialized
> somewhere with the pointer value of Qnil. (&Qnil)

Read the comments.

  /* All Lisp_Object components must come first.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



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

end of thread, other threads:[~2010-12-02 13:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-02  8:54 wrong behaviour of <struct frame> alin soare
2010-12-02  9:12 ` Jan Djärv
2010-12-02  9:14   ` Alin Soare
2010-12-02  9:45 ` martin rudalics
2010-12-02 13:14 ` Andreas Schwab

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.