]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix leak of saved menu event and output data
authorPo Lu <luangruo@yahoo.com>
Tue, 22 Mar 2022 00:39:55 +0000 (08:39 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 22 Mar 2022 00:39:55 +0000 (08:39 +0800)
* src/xterm.c (x_destroy_window, x_free_frame_resources): Free
output data and saved menu event even if display is closed.

src/xterm.c

index 3f16a116ebf7edbd54463232af9ad345a3efe2b5..be1dc9e3c98619ffa3bcb39eb8c363572708fb56 100644 (file)
@@ -17565,9 +17565,11 @@ x_free_frame_resources (struct frame *f)
 
   if (x_dnd_in_progress && f == x_dnd_frame)
     {
+      block_input ();
       if (x_dnd_last_seen_window != None
          && x_dnd_last_protocol_version != -1)
        x_dnd_send_leave (f, x_dnd_last_seen_window);
+      unblock_input ();
 
       x_dnd_in_progress = false;
       x_dnd_waiting_for_finish = false;
@@ -17737,10 +17739,6 @@ x_free_frame_resources (struct frame *f)
     g_object_unref (FRAME_OUTPUT_DATA (f)->scrollbar_foreground_css_provider);
 #endif
 
-  xfree (f->output_data.x->saved_menu_event);
-  xfree (f->output_data.x);
-  f->output_data.x = NULL;
-
   if (f == dpyinfo->x_focus_frame)
     dpyinfo->x_focus_frame = 0;
   if (f == dpyinfo->x_focus_event_frame)
@@ -17766,6 +17764,10 @@ x_destroy_window (struct frame *f)
   if (dpyinfo->display != 0)
     x_free_frame_resources (f);
 
+  xfree (f->output_data.x->saved_menu_event);
+  xfree (f->output_data.x);
+  f->output_data.x = NULL;
+
   dpyinfo->reference_count--;
 }