[gtk/gtk-3-24.ime-event.fixes: 24/24] gdkevents-win32.c: Fix GDK_SETTING event notification on IME change



commit b4c3ffc1f1f629d51ad37f88defe0f07216ccaf2
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Dec 10 14:47:17 2018 +0800

    gdkevents-win32.c: Fix GDK_SETTING event notification on IME change
    
    We need to call g_strdup() on the name that we pass in for notifying the
    GDK_SETTING event so that when we do gdk_event_free() later we will not
    get a crash (stack corruption) that results from attempting to g_free()
    something that is not dynamically allocated.

 gdk/win32/gdkevents-win32.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index a2698e3cfc..6b90d42318 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -2256,7 +2256,7 @@ gdk_settings_notify (GdkWindow        *window,
   new_event->setting.window = window;
   new_event->setting.send_event = FALSE;
   new_event->setting.action = action;
-  new_event->setting.name = (char*) name;
+  new_event->setting.name = g_strdup (name);
 
   _gdk_win32_append_event (new_event);
 }
@@ -2475,7 +2475,9 @@ gdk_event_translate (MSG  *msg,
                         (gulong) msg->wParam,
                         (gpointer) msg->lParam, _gdk_input_locale_is_ime ? " (IME)" : "",
                         _gdk_input_codepage));
+
       gdk_settings_notify (window, "gtk-im-module", GDK_SETTING_ACTION_CHANGED);
+
       break;
 
     case WM_SYSKEYUP:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]