[PyKDE] C++ Anomalie
Joshua J. Kugler
joshua at eeinternet.com
Thu Oct 5 19:33:51 BST 2006
[Please pardon the top post]
Jim, how are you connecting to KSpread? Are you using DCOP? Something else?
I really don't know anything about C++ scripting of KSpread, but I do know
there are DCOP interfaces that might simplify things. But maybe not.
j
On Wednesday 04 October 2006 23:55, Jim Bublitz wrote:
> I realize this isn't a PyKDE question, but there are some good C++
> programmers here, and I thought maybe someone could tell me what's going on
> here. I've had this problem with the SuSE rpms of KSpread, and even
> recompiled KSpread with debug info and get the same result.
>
> I'm duplicating some KSpread code in trying to do Python scripting with
> KSpread. The code I'm copying is directly from KSpread and seems to work
> there (it's invoked any time you format a cell). One statement in the code
> I've copied leads to a situation where the following methods eventually get
> called.
>
> Notice that the variable 'range' is declared as an argument of type QRect&.
> Nowhere in the following method does QString appear, yet the createRange
> call at the end of the first method invariably calls the QString version of
> createRange, which then segfaults (because it's calling QString methods on
> what's really a QRect).
>
> Anybody have any idea what's going on?
>
> Jim
>
> Region::Iterator Region::insert(Region::Iterator pos, const QRect& range,
> Sheet* sheet, bool multi)
> {
>
> ...
>
> if ( !containsRange )
> {
> printf ("is range a QRect?\n");
> printf ("range x = %i y = %i\n", range.x (), range.y ());
> printf ("calling createRange\n");
> Range* rrange = createRange(range);
>
> ...
> }
>
>
> Region::Range* Region::createRange(const QRect& rect) const
> {
> printf ("create range from rect\n");
> return new Range(rect);
> }
>
> // this always gets called, even though 'range' is a QRect.
>
> Region::Range* Region::createRange(const QString& string) const
> {
> printf ("create range from string\n");
> return new Range(string);
> }
>
>
> Program Output:
>
> is range a QRect?
> range x = 1 y = 1
> calling createRange
> create range from string
> KCrash: Application 'testKSpread.py' crashing...
>
>
> Traceback:
>
> [KCrash handler]
> #9 0x40ef5770 in QString::find () from /usr/lib/libqt-mt.so.3
> #10 0x42f03cad in QString::find (this=0xbfd4e3c0, c=58 ':', index=0,
> cs=false) at qstring.h:996
> #11 0x4305a218 in Range (this=0x8490078, sRange=@0xbfd4e3c0) at
> region.cc:913 #12 0x4305a349 in KSpread::Region::createRange
> (this=0x83a2eb8,
> string=@0xbfd4e3c0) at region.cc:732
> =====
>
> Note the type of the arg in #12 above.
>
> _______________________________________________
> PyKDE mailing list PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
--
Joshua Kugler
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE
PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111
More information about the PyQt
mailing list