summaryrefslogtreecommitdiffstats
path: root/generic/tkUtil.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-04-21 22:03:01 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-04-21 22:03:01 (GMT)
commit00604f72c60af9ed0748c955048a446f7e5f7b9c (patch)
tree5deeaa223aed9f5fa42e43c83865f4287756eab3 /generic/tkUtil.c
parentfa289415c7aaacc173ab97665af201a54eae611a (diff)
downloadtk-00604f72c60af9ed0748c955048a446f7e5f7b9c.zip
tk-00604f72c60af9ed0748c955048a446f7e5f7b9c.tar.gz
tk-00604f72c60af9ed0748c955048a446f7e5f7b9c.tar.bz2
Fixed [b362182e45] - Generation of virtual events through Tk_HandleEvent is unsafe
Diffstat (limited to 'generic/tkUtil.c')
-rw-r--r--generic/tkUtil.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/generic/tkUtil.c b/generic/tkUtil.c
index 7ff9ecb..6563165 100644
--- a/generic/tkUtil.c
+++ b/generic/tkUtil.c
@@ -1162,7 +1162,8 @@ TkMakeEnsemble(
* TkSendVirtualEvent --
*
* Send a virtual event notification to the specified target window.
- * Equivalent to "event generate $target <<$eventName>>"
+ * Equivalent to:
+ * "event generate $target <<$eventName>> -data $detail"
*
* Note that we use Tk_QueueWindowEvent, not Tk_HandleEvent, so this
* routine does not reenter the interpreter.
@@ -1173,7 +1174,8 @@ TkMakeEnsemble(
void
TkSendVirtualEvent(
Tk_Window target,
- const char *eventName)
+ const char *eventName,
+ Tcl_Obj *detail)
{
union {XEvent general; XVirtualEvent virtual;} event;
@@ -1184,6 +1186,9 @@ TkSendVirtualEvent(
event.general.xany.window = Tk_WindowId(target);
event.general.xany.display = Tk_Display(target);
event.virtual.name = Tk_GetUid(eventName);
+ if (detail != NULL) {
+ event.virtual.user_data = detail;
+ }
Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL);
}