Permalink
Browse files

python should not add or remove guicontrols without going through the…

… app messenger. fixes #12791
  • Loading branch information...
1 parent 50dd38d commit e8a3006ac5fdf271b5cdd26dd779871611132763 Jonathan Marshall committed Mar 13, 2012
Showing with 12 additions and 6 deletions.
  1. +12 −6 xbmc/interfaces/python/xbmcmodule/window.cpp
View
18 xbmc/interfaces/python/xbmcmodule/window.cpp
@@ -662,9 +662,12 @@ namespace PYXBMC
// add control to list and allocate recources for the control
self->vecControls.push_back(pControl);
- pControl->pGUIControl->AllocResources();
- self->pWindow->AddControl(pControl->pGUIControl);
-
+ {
+ CPyThreadState state;
+ CGUIMessage msg(GUI_MSG_ADD_CONTROL, 0, 0);
+ msg.SetPointer(pControl->pGUIControl);
+ g_application.getApplicationMessenger().SendGUIMessage(msg, self->iWindowId, true);
+ }
Py_INCREF(Py_None);
return Py_None;
}
@@ -809,9 +812,12 @@ namespace PYXBMC
} else ++it;
}
- self->pWindow->RemoveControl(pControl->pGUIControl);
- pControl->pGUIControl->FreeResources();
- delete pControl->pGUIControl;
+ {
+ CPyThreadState state;
+ CGUIMessage msg(GUI_MSG_REMOVE_CONTROL, 0, 0);
+ msg.SetPointer(pControl->pGUIControl);
+ g_application.getApplicationMessenger().SendGUIMessage(msg, self->iWindowId, true);
+ }
// initialize control to zero
pControl->pGUIControl = NULL;

0 comments on commit e8a3006

Please sign in to comment.