Modified by: Brandon Philips <brandon osuosl.org>
Date: <03:27:07>
Project: Player, pykit
Bug Number: 5978
Bug URL:
https://bugs.helixcommunity.org/show_bug.cgi?id=5978
Synopsis: Set variables to NULL to avoid assertions
Overview: A number of buffers were not being initialized to
NULL and
caused assertions in a number of code paths for the stat
method of
hxplay.
Files Modified:
player/kit/python/pyplayer.cpp - initialize pointer values
player/kit/python/examples/player.py - add stats label to
the window
Platforms and Profiles Build Verified:
x86 player_kit_python helix-client-all-defines
Branch: helix
Copyright assignment: In consideration for RealNetworks'
hosting and
maintenance of my modification, I agree to assign to
RealNetworks full
copyright ownership of the code included in the attached
patch, and
agree that RealNetworks has no duty of accounting to me for
it. I
warrant that this code is entirely original to and owned by
me, that I
can legally grant the copyright assignment, and that my
contribution
does not violate any other person's rights, and laws or
breach any
contract. I understand that RealNetworks may license this
code under
RPSL, RCSL, and/or any other license at RealNetworks'
discretion, and
use the code in any way.
QA Instructions:
- This call used to kill and backtrace the process- test
this function
now?
--
Index: pyplayer.cpp
============================================================
=======
RCS file: /cvsroot/player/kit/python/pyplayer.cpp,v
retrieving revision 1.9
diff -u -r1.9 pyplayer.cpp
--- pyplayer.cpp 22 Mar 2007 04:27:39 -0000 1.9
+++ pyplayer.cpp 27 Mar 2007 23:25:22 -0000
 -700,13
+700,13 
PyObject*
PyPlayer::GetStats(const char *name, UINT32 baseid /*=0*/)
{
- IHXRegistry *piRegistry;
- IHXRegistryID *piRegId;
+ IHXRegistry *piRegistry = NULL;
+ IHXRegistryID *piRegId = NULL;
UINT32 ulRegId;
- PyObject *stat, *dict;
+ PyObject *stat, *dict = NULL;
char statname[MAX_DISPLAY_NAME];
char prefix[MAX_DISPLAY_NAME];
- IHXBuffer *pNameBuf;
+ IHXBuffer *pNameBuf = NULL;
UINT32 id;
HX_RESULT res;
 -719,6
+719,8 
return FALSE;
}
+
+ /* get the registry id for this player */
res = m_piPlayer->QueryInterface(IID_IHXRegistryID,
(void**)&piRegId);
if (FAILED(res))
{
 -833,8
+835,8 
PyObject *prop=NULL;
HXPropType type;
INT32 val;
- IHXBuffer *buffer;
- IHXValues *proplist;
+ IHXBuffer *buffer = NULL;
+ IHXValues *proplist = NULL;
HX_RESULT res;
TRACE(TRACE_PYHXPLAYER, ("prop name: %sn",
name))
 -944,6
+946,7 
Py_INCREF(prop);
}
proplist->Release();
+ proplist = NULL;
}
else
{
Index: examples/player.py
============================================================
=======
RCS file: /cvsroot/player/kit/python/examples/player.py,v
retrieving revision 1.18
diff -u -r1.18 player.py
--- examples/player.py 23 Mar 2007 19:36:41 -0000 1.18
+++ examples/player.py 27 Mar 2007 23:25:22 -0000
 -122,6
+122,10 
self.player.start()
self.playing=1
self.sizeupdated=0
+ artist =
self.player.stats("Source0.Author")
+ title =
self.player.stats("Source0.Title")
+ self.statslabel.set_text(artist + ": " +
title)
+
def start(self, widget):
if (self.player != None):
 -271,6
+275,11 
self.progressbar.connect("change-value",
self.barseek)
self.progressbar.connect("button-release-event",
self.buttonup)
self.progressbar.connect("button-press-event",
self.buttondown)
+
+ self.statslabel = gtk.Label()
+ self.statslabel.set_justify(gtk.JUSTIFY_LEFT)
+ self.statslabel.show()
+ vbox.add(self.statslabel)
#add slider for setting volume
self.volume = gtk.HScale()
_______________________________________________
Player-dev mailing list
Player-dev helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/play
er-dev
|