]> Dogcows Code - chaz/openbox/blobdiff - src/python.cc
watch for bad actions and contexts
[chaz/openbox] / src / python.cc
index 179e737264e9b0c2da1df04a95d8b029b5a1756f..a99416ae83899bc72ec3e4ec118321dbf9e18273 100644 (file)
@@ -44,7 +44,6 @@ void python_init(char *argv0)
 
 void python_destroy()
 {
-  Py_DECREF(obdict);
   Py_Finalize();
 }
 
@@ -102,6 +101,14 @@ PyObject *mbind(const std::string &button, ob::MouseContext::MC context,
     PyErr_SetString(PyExc_TypeError, "Invalid callback function.");
     return NULL;
   }
+  if(context < 0 || context >= MouseContext::NUM_MOUSE_CONTEXT) {
+    PyErr_SetString(PyExc_ValueError, "Invalid MouseContext");
+    return NULL;
+  }
+  if(action < 0 || action >= MouseAction::NUM_MOUSE_ACTION) {
+    PyErr_SetString(PyExc_ValueError, "Invalid MouseAction");
+    return NULL;
+  }
   
   if (!ob::openbox->bindings()->addButton(button, context,
                                           action, func)) {
@@ -190,6 +197,7 @@ PyObject *kbind(PyObject *keylist, ob::KeyContext::KC context, PyObject *func)
   Py_INCREF(Py_None); return Py_None;
 }
 
+/*
 PyObject *kunbind(PyObject *keylist, PyObject *func)
 {
   if (!PyList_Check(keylist)) {
@@ -218,6 +226,7 @@ PyObject *kunbind(PyObject *keylist, PyObject *func)
   }
   Py_INCREF(Py_None); return Py_None;
 }
+*/
 
 void kunbind_all()
 {
This page took 0.025026 seconds and 4 git commands to generate.