1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

fixed memory leaks and crash with deminiaturization

This commit is contained in:
kojima
2000-03-29 03:58:25 +00:00
parent 03e14f363f
commit 3d7cb106af
5 changed files with 60 additions and 41 deletions

View File

@@ -2751,7 +2751,7 @@ setClearance(WScreen *scr, WDefaultEntry *entry, void *bar, void *foo)
}
static int
setIfDockPresent(WScreen *scr, WDefaultEntry *entry, int *flag, long which)
setIfDockPresent(WScreen *scr, WDefaultEntry *entry, char *flag, long which)
{
switch (which) {
case WM_DOCK:
@@ -3424,7 +3424,7 @@ setDoubleClick(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
static int
setMultiByte(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
setMultiByte(WScreen *scr, WDefaultEntry *entry, char *value, void *foo)
{
extern _WINGsConfiguration WINGsConfiguration;

View File

@@ -1535,9 +1535,7 @@ static WAppIcon*
restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
{
WAppIcon *aicon;
char *wclass, *winstance;
proplist_t cmd, value;
char *command;
cmd = PLGetDictionaryEntry(info, dCommand);
@@ -1550,6 +1548,10 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
if (!value)
return NULL;
{
char *wclass, *winstance;
char *command;
ParseWindowName(value, &winstance, &wclass, "dock");
if (!winstance && !wclass) {
@@ -1580,6 +1582,9 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
free(wclass);
if (winstance)
free(winstance);
if (command)
free(command);
}
aicon->icon->core->descriptor.handle_mousedown = iconMouseDown;
if (type == WM_CLIP) {

View File

@@ -653,6 +653,7 @@ handleButtonPress(XEvent *event)
}
#endif /* !LITE */
desc = NULL;
if (XFindContext(dpy, event->xbutton.subwindow, wWinContext,
(XPointer *)&desc)==XCNOENT) {
if (XFindContext(dpy, event->xbutton.window, wWinContext,
@@ -661,10 +662,6 @@ handleButtonPress(XEvent *event)
}
}
if (desc->handle_mousedown!=NULL) {
(*desc->handle_mousedown)(desc, event);
}
if (desc->parent_type == WCLASS_WINDOW) {
XSync(dpy, 0);
@@ -689,6 +686,10 @@ handleButtonPress(XEvent *event)
}
}
if (desc->handle_mousedown!=NULL) {
(*desc->handle_mousedown)(desc, event);
}
/* save double-click information */
if (scr->flags.next_click_is_not_double) {
scr->flags.next_click_is_not_double = 0;

View File

@@ -1164,6 +1164,19 @@ keysymToString(KeySym keysym, unsigned int state)
}
#endif
static char *
appendrealloc(char *a, char *b)
{
if (a == NULL)
return wstrdup(b);
else {
char *c = wstrappend(a, b);
free(a);
return c;
}
}
char*
GetShortcutString(char *text)
{
@@ -1189,33 +1202,33 @@ GetShortcutString(char *text)
modmask |= mod;
if (strcasecmp(text, "Meta")==0) {
buffer = wstrappend(buffer, "M+");
buffer = appendrealloc(buffer, "M+");
} else if (strcasecmp(text, "Alt")==0) {
buffer = wstrappend(buffer, "A+");
buffer = appendrealloc(buffer, "A+");
} else if (strcasecmp(text, "Shift")==0) {
buffer = wstrappend(buffer, "Sh+");
buffer = appendrealloc(buffer, "Sh+");
} else if (strcasecmp(text, "Mod1")==0) {
buffer = wstrappend(buffer, "M1+");
buffer = appendrealloc(buffer, "M1+");
} else if (strcasecmp(text, "Mod2")==0) {
buffer = wstrappend(buffer, "M2+");
buffer = appendrealloc(buffer, "M2+");
} else if (strcasecmp(text, "Mod3")==0) {
buffer = wstrappend(buffer, "M3+");
buffer = appendrealloc(buffer, "M3+");
} else if (strcasecmp(text, "Mod4")==0) {
buffer = wstrappend(buffer, "M4+");
buffer = appendrealloc(buffer, "M4+");
} else if (strcasecmp(text, "Mod5")==0) {
buffer = wstrappend(buffer, "M5+");
buffer = appendrealloc(buffer, "M5+");
} else if (strcasecmp(text, "Control")==0) {
control = 1;
} else {
buffer = wstrappend(buffer, text);
buffer = appendrealloc(buffer, text);
}
text = k+1;
}
if (control) {
buffer = wstrappend(buffer, "^");
buffer = appendrealloc(buffer, "^");
}
buffer = wstrappend(buffer, text);
buffer = appendrealloc(buffer, text);
/* get key */
/* ksym = XStringToKeysym(text);

View File

@@ -256,7 +256,7 @@ x_reset_modifier_mapping (Display *display)
" by the keysyms used to control those bits. Mod1 does NOT always\n"
" mean Meta, although some non-ICCCM-compliant programs assume that.\n");
#endif
XFree(x_modifier_keymap);
XFreeModifiermap(x_modifier_keymap);
}