statusicon: fix crash storing pointer in UINT
https://bugzilla.gnome.org/show_bug.cgi?id=696505
This commit is contained in:
parent
851d784f6d
commit
f07677c105
@ -693,6 +693,24 @@ button_callback (gpointer data)
|
|||||||
|
|
||||||
static UINT taskbar_created_msg = 0;
|
static UINT taskbar_created_msg = 0;
|
||||||
static GSList *status_icons = NULL;
|
static GSList *status_icons = NULL;
|
||||||
|
static UINT status_icon_id = 0;
|
||||||
|
|
||||||
|
static GtkStatusIcon *
|
||||||
|
find_status_icon (UINT id)
|
||||||
|
{
|
||||||
|
GSList *rover;
|
||||||
|
|
||||||
|
for (rover = status_icons; rover != NULL; rover = rover->next)
|
||||||
|
{
|
||||||
|
GtkStatusIcon *status_icon = GTK_STATUS_ICON (rover->data);
|
||||||
|
GtkStatusIconPrivate *priv = status_icon->priv;
|
||||||
|
|
||||||
|
if (priv->nid.uID == id)
|
||||||
|
return status_icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static LRESULT CALLBACK
|
static LRESULT CALLBACK
|
||||||
wndproc (HWND hwnd,
|
wndproc (HWND hwnd,
|
||||||
@ -754,7 +772,7 @@ wndproc (HWND hwnd,
|
|||||||
buttondown0:
|
buttondown0:
|
||||||
bc = g_new (ButtonCallbackData, 1);
|
bc = g_new (ButtonCallbackData, 1);
|
||||||
bc->event = (GdkEventButton *) gdk_event_new (GDK_BUTTON_PRESS);
|
bc->event = (GdkEventButton *) gdk_event_new (GDK_BUTTON_PRESS);
|
||||||
bc->status_icon = GTK_STATUS_ICON (wparam);
|
bc->status_icon = find_status_icon (wparam);
|
||||||
build_button_event (bc->status_icon->priv, bc->event, button);
|
build_button_event (bc->status_icon->priv, bc->event, button);
|
||||||
g_idle_add (button_callback, bc);
|
g_idle_add (button_callback, bc);
|
||||||
break;
|
break;
|
||||||
@ -780,7 +798,7 @@ wndproc (HWND hwnd,
|
|||||||
buttonup0:
|
buttonup0:
|
||||||
bc = g_new (ButtonCallbackData, 1);
|
bc = g_new (ButtonCallbackData, 1);
|
||||||
bc->event = (GdkEventButton *) gdk_event_new (GDK_BUTTON_RELEASE);
|
bc->event = (GdkEventButton *) gdk_event_new (GDK_BUTTON_RELEASE);
|
||||||
bc->status_icon = GTK_STATUS_ICON (wparam);
|
bc->status_icon = find_status_icon (wparam);
|
||||||
build_button_event (bc->status_icon->priv, bc->event, button);
|
build_button_event (bc->status_icon->priv, bc->event, button);
|
||||||
g_idle_add (button_callback, bc);
|
g_idle_add (button_callback, bc);
|
||||||
break;
|
break;
|
||||||
@ -927,7 +945,7 @@ gtk_status_icon_init (GtkStatusIcon *status_icon)
|
|||||||
memset (&priv->nid, 0, sizeof (priv->nid));
|
memset (&priv->nid, 0, sizeof (priv->nid));
|
||||||
|
|
||||||
priv->nid.hWnd = create_tray_observer ();
|
priv->nid.hWnd = create_tray_observer ();
|
||||||
priv->nid.uID = GPOINTER_TO_UINT (status_icon);
|
priv->nid.uID = status_icon_id++;
|
||||||
priv->nid.uCallbackMessage = WM_GTK_TRAY_NOTIFICATION;
|
priv->nid.uCallbackMessage = WM_GTK_TRAY_NOTIFICATION;
|
||||||
priv->nid.uFlags = NIF_MESSAGE;
|
priv->nid.uFlags = NIF_MESSAGE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user