Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » Strange memory problem in QTF RichView
Strange memory problem in QTF RichView [message #25597] Wed, 03 March 2010 00:21 Go to next message
mdelfede is currently offline  mdelfede
Messages: 1259
Registered: September 2007
Senior Contributor
#include <CtrlLib/CtrlLib.h>

using namespace Upp;

class TestQTF : public TopWindow
{
	private:
		RichTextView tv;
		
	public:
		typedef TestQTF CLASSNAME;
		TestQTF();
};

TestQTF::TestQTF()
{
	Add(tv.SizePos());
	tv.SetQTF((String)"[, pipopo xxx ]kkkk {{");
}

GUI_APP_MAIN
{
	TestQTF().Run();
}


It shows the error in following image :

index.php?t=getfile&id=2373&private=0

I don't know if it's related to QTF, RichView or String conversion. Without the (String) conversion, the 'freefreefree' is not shown (correctly).
The example is taken from an more complex one using EditString content to fill RichView :

EditString es;
es.SetText("[, pipopo xxx ]kkkk {{");
tv.SetQTF((String)es);


The result is exactly the same.
I noted this because on a bigger app I get weird memory problems that happens once on 30-40 runs, on which sometimes the app hangs on qtf output or renders QTF in weird way with many freefreefree inside.

Ciao

Max

p.s.: an even clearer testcase :

TestQTF::TestQTF()
{
	Add(tv.SizePos());
	String s = "[, pipopo xxx ]kkkk {{";
	tv.SetQTF(s);
}


I tested it even with string as static (global), but the result is the same. I think the bug is related to SetQTF() or qtf processing, not String.
  • Attachment: TestQTF.jpg
    (Size: 8.90KB, Downloaded 358 times)

[Updated on: Wed, 03 March 2010 00:33]

Report message to a moderator

Re: Strange memory problem in QTF RichView [message #25599 is a reply to message #25597] Wed, 03 March 2010 07:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 11844
Registered: November 2005
Ultimate Member
Thanks, fixed.

Your QTF is ill formed - ends with '{{', which is start of table and should be followed at least by space, but the problem was that parsing code fetched terminating zero, correctly decided there should not be any terminating zero at that point, but then while reporting the error attemted to read text past this terminating zero (which lead to "Free" usually and to crash sometimes).

So it was basically bug in bug reporting.

Mirek
Re: Strange memory problem in QTF RichView [message #25605 is a reply to message #25599] Wed, 03 March 2010 11:25 Go to previous message
mdelfede is currently offline  mdelfede
Messages: 1259
Registered: September 2007
Senior Contributor
luzr wrote on Wed, 03 March 2010 07:40

Thanks, fixed.

Your QTF is ill formed - ends with '{{', which is start of table and should be followed at least by space, but the problem was that parsing code fetched terminating zero, correctly decided there should not be any terminating zero at that point, but then while reporting the error attemted to read text past this terminating zero (which lead to "Free" usually and to crash sometimes).

So it was basically bug in bug reporting.

Mirek


Yep, I know that the QTF was malformed, but it was on purpose to demonstrate the bug. I don't know it the bug could happen also on corrected code.
BTW, in my app I have random of such problems, as I said before, but I can't reproduce them, because they happens seldom with the same test file.... they may be caused by other hidden bug.
Anyways, this bug could arise when constructing the qtf output directly with SetQTF, adding small pieces of qtf in steps, like my app does.

Ciao

Max
Previous Topic: RichText scrolling problem
Next Topic: WMF to pdf
Goto Forum:
  


Current Time: Fri Apr 26 06:26:36 CEST 2019

Total time taken to generate the page: 0.01076 seconds