summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2013-05-25 09:18:26 +0200
committerportix <portix@gmx.net>2013-05-25 09:18:26 +0200
commitc69e858b8de9096cd959e653c74667fe8f6390f2 (patch)
treedae9517bc9f5d018613102141ca3f67a49f4dbcd
parent3eec71ae283fcf04b1fa30aa0cd11c83e426aebd (diff)
downloaddwb-c69e858b8de9096cd959e653c74667fe8f6390f2.zip
Fixing segfault in commands_zoom/scroll if argument is used on commandline
-rw-r--r--src/commands.c6
-rw-r--r--src/dwb.c19
2 files changed, 11 insertions, 14 deletions
diff --git a/src/commands.c b/src/commands.c
index 24d225c2..e9efe30a 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -336,8 +336,7 @@ commands_zoom(KeyMap *km, Arg *arg)
DwbStatus
commands_scroll(KeyMap *km, Arg *arg)
{
- GList *gl = arg->p ? arg->p : dwb.state.fview;
- dwb_scroll(gl, dwb.misc.scroll_step, arg->n);
+ dwb_scroll(dwb.state.fview, dwb.misc.scroll_step, arg->n);
return STATUS_OK;
}/*}}}*/
@@ -345,10 +344,9 @@ commands_scroll(KeyMap *km, Arg *arg)
DwbStatus
commands_set_zoom_level(KeyMap *km, Arg *arg)
{
- GList *gl = arg->p ? arg->p : dwb.state.fview;
double zoomlevel = dwb.state.nummod < 0 ? arg->d : (double)dwb.state.nummod / 100;
- webkit_web_view_set_zoom_level(WEBKIT_WEB_VIEW(((View*)gl->data)->web), zoomlevel);
+ webkit_web_view_set_zoom_level(CURRENT_WEBVIEW(), zoomlevel);
dwb_set_normal_message(dwb.state.fview, true, "Zoomlevel: %d%%", (int)(zoomlevel * 100));
return STATUS_OK;
}/*}}}*/
diff --git a/src/dwb.c b/src/dwb.c
index f47f696d..c923ac03 100644
--- a/src/dwb.c
+++ b/src/dwb.c
@@ -4915,27 +4915,27 @@ dwb_parse_command_line(const char *line)
return STATUS_OK;
DwbStatus ret = STATUS_OK;
- const char *bak;
- int nummod;
- line = util_str_chug(line);
- bak = dwb_parse_nummod(line);
- nummod = dwb.state.nummod;
- char **token = g_strsplit(bak, " ", 2);
+ const char *bak = NULL;
+ char **token = NULL;
KeyMap *m = NULL;
- gboolean found;
+ gboolean found = false;
gboolean has_arg = false;
const char *argument = NULL;
+ line = util_str_chug(line);
+ bak = dwb_parse_nummod(line);
+ token = g_strsplit(bak, " ", 2);
+
if (!token[0])
return STATUS_OK;
+ bak = token[0];
+
if (token[1])
has_arg = true;
for (GList *l = dwb.keymap; l; l=l->next)
{
- bak = token[0];
- found = false;
m = l->data;
if (!g_strcmp0(m->map->n.first, bak))
found = true;
@@ -4955,7 +4955,6 @@ dwb_parse_command_line(const char *line)
if (m->map->prop & CP_HAS_MODE)
dwb_change_mode(NORMAL_MODE, true);
- dwb.state.nummod = nummod;
if (token[1] && ! m->map->arg.ro)
{
g_strstrip(token[1]);