Subject: Re: bug#6414: f->output_data.w32->menubar_widget uninitialized?

From: Lennart Borgman <[email-masked]>
Date: Mon, 4 Jul 2011 01:11:09 +0200

On Mon, Jul 4, 2011 at 00:48, Juanma Barranquero <[email-masked]> wrote:
> On Mon, Jul 4, 2011 at 00:37, Lennart Borgman <[email-masked]> wrote:
>
>> It has been some time since I suggested this, but as far as I remember
>> I looked into this because I had quite a few crashes. They seemed to
>> be related to menus.
>
> Yes, I've seen these bug reports, but they usually don't have enough
> information to follow through (for what I've seen, Eli tried to get
> you to add more information, with mixed results).

I tried to do that, but as I said in another thread I do not see the
same problem in my patched build any more. (But I see new problems on
64-bit windows.)

>> Yes, correct. And I pointed to another place where I thought the
>> problem was instead.
>
> Yes, but still not saying what the problem is. You had crashes in
> menus, and you filed other bug reports for them. I'm talking about
> this "bug" report.

This is a complement to them. We agreed to file bug report for code
changes we should not forget. This is one of those.

Do you agree that this report is a reasonable way to tell you what I
have done to try to fix the problem and get your thoughts on it?
Otherwise suggest something else. (I can't do much now, but perhaps
later.)

>> Since you asked for a recipe I thought I had to mention this again. It
>> looked to me that you overlooked this problem again.
>
> "Overlooked [...] again"?

Yes. The problem with race conditions was one of the main reasons for
my suggestion to add error checking to all system calls. I thought
that you might have overlooked this since you suggested that I should
send a clear recipe for how to reproduce the bug. But maybe you did
not do that? Please explain if I am misunderstanding you.

>> Did you look at the logic as I suggested?
>
> If the logic is flawed and there's an unitialized struct, it will
> likely cause bugs and crashes. We only have a few such reports, by
> you, but they are not very informative, often it is not clear whether
> it happens with stock Emacs or you patched one (which includes changes
> in menu functions), and I don't even know if you've had more such
> crashes recently or they were a year or two ago. Lots of things have
> changed in between.

I think I was wrong about the initialization. As I said later I think
the structure was initialized.

Yes, I have a lot of changes in that area. Complicated, unfortunately.
I think I have lost control of the details there now. And I never felt
I had complete control of it. The code is complex and I am not even
sure that we are always doing things in the right thread etc.

However after fixing the things I suggested I have not seen those
crashes any more as far as I remember. But it might be that I have
changed my usage pattern of Emacs. Nowadays I am mostly using org-mode
with my bibhlp.el extensions.

>> If you are sure my
>> suggestion is wrong then feel free to close the bug.
>
> If your suggestion is anything other than "all system calls should be
> checked", which has already been discussed in emacs-devel, I fail to
> see what it is. Care to clarify?

Yes, it is this that I wrote earlier:

  "The problem seems to be in x_free_frame_resources. Should not
  free_frame_menubar be called before my_destroy_window there?"

We might disagree, but be sure I am glad for your efforts!