[Kde-bindings] Re: one general question

Sven Aßmann sven.assmann at lubico.biz
Thu Oct 28 19:22:49 UTC 2010


For interested:

i found the problem on a zend header:
have a look at the first macro and find the error :)

#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, 
handle_fcall, handle_propget, handle_propset) \
	INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, 
sizeof(class_name)-1, functions, handle_fcall, handle_propget, handle_propset, 
NULL, NULL)

ok.. i say it: class_name is a const char* and i learned in the first semester 
that sizeof (char *) is 4 on a 32bit machine like all pointers.. and so it 
cannot be used for determine the right memory size.. 

instead its better to use strlen and add 1 byte for the terminating 0:

#define INIT_OVERLOADED_CLASS_ENTRY(class_container, class_name, functions, 
handle_fcall, handle_propget, handle_propset) \
INIT_OVERLOADED_CLASS_ENTRY_EX(class_container, class_name, 
strlen(class_name)+1, functions, handle_fcall, handle_propget, handle_propset, 
NULL, NULL)

dit you agree that?

Sven
Am Donnerstag, 28. Oktober 2010 20:59:41 schrieb Sven Aßmann:
> Hi, 
> 
> i work an the phpsmoke bindings, and now im figured out something strange, 
> perhaps can anybody give me a hint or a commet that may help me..
> 
> the details:
> i initialize the php class modules that i find in the specific smoke 
binding, 
> so far so good.. i analyse the inheritance and initialize all parents too in 
> the correct way.. then i will connect the child to the parent class during:
> 
> zend_do_inheritance(ce_ptr, parent_ce TSRMLS_CC);
> 
> this works fine until this case occures: (transitive inheritance)
> 
> child -> parent of child 1 -> parent of the parent
> 
> QAbstractListModel -> QAbstractItemModel -> QObject
> 
> So now the real strange: if i use valgrind to look at the problem, it does 
not 
> segfaulted on this position!!
> 
> Has anyone has any idea?? 
> 
> Thanks
> Sven
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20101028/7c9bec24/attachment.sig>


More information about the Kde-bindings mailing list