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:
@@ -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;
|
||||
|
||||
|
||||
51
src/dock.c
51
src/dock.c
@@ -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,37 +1548,44 @@ restore_icon_state(WScreen *scr, proplist_t info, int type, int index)
|
||||
if (!value)
|
||||
return NULL;
|
||||
|
||||
ParseWindowName(value, &winstance, &wclass, "dock");
|
||||
{
|
||||
char *wclass, *winstance;
|
||||
char *command;
|
||||
|
||||
if (!winstance && !wclass) {
|
||||
return NULL;
|
||||
}
|
||||
ParseWindowName(value, &winstance, &wclass, "dock");
|
||||
|
||||
/* get commands */
|
||||
if (!winstance && !wclass) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (cmd)
|
||||
command = wstrdup(PLGetString(cmd));
|
||||
else
|
||||
command = NULL;
|
||||
/* get commands */
|
||||
|
||||
if (!command || strcmp(command, "-")==0) {
|
||||
if (command)
|
||||
free(command);
|
||||
if (cmd)
|
||||
command = wstrdup(PLGetString(cmd));
|
||||
else
|
||||
command = NULL;
|
||||
|
||||
if (!command || strcmp(command, "-")==0) {
|
||||
if (command)
|
||||
free(command);
|
||||
if (wclass)
|
||||
free(wclass);
|
||||
if (winstance)
|
||||
free(winstance);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
aicon = wAppIconCreateForDock(scr, command, winstance, wclass,
|
||||
TILE_NORMAL);
|
||||
if (wclass)
|
||||
free(wclass);
|
||||
if (winstance)
|
||||
free(winstance);
|
||||
|
||||
return NULL;
|
||||
if (command)
|
||||
free(command);
|
||||
}
|
||||
|
||||
aicon = wAppIconCreateForDock(scr, command, winstance, wclass,
|
||||
TILE_NORMAL);
|
||||
if (wclass)
|
||||
free(wclass);
|
||||
if (winstance)
|
||||
free(winstance);
|
||||
|
||||
aicon->icon->core->descriptor.handle_mousedown = iconMouseDown;
|
||||
if (type == WM_CLIP) {
|
||||
aicon->icon->core->descriptor.handle_enternotify = clipEnterNotify;
|
||||
|
||||
@@ -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;
|
||||
|
||||
35
src/misc.c
35
src/misc.c
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user