Crystal Space
Welcome, Guest. Please login or register.
November 20, 2017, 05:05:55 am

Login with username, password and session length
Search:     Advanced search
9081 Posts in 2051 Topics by 80488 Members
Latest Member: Ertopqwe
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  Writing Text && Changing bg Color == Crash (UPDATE: worked around)
« previous next »
Pages: [1] Print
Author Topic: Writing Text && Changing bg Color == Crash (UPDATE: worked around)  (Read 1756 times)
Posts: 30

View Profile Email
« on: November 07, 2010, 11:33:30 pm »

OS: Win7
CS Ver: 1.4.0
Graphics Card: GeForce GT 220

So... I tried building CS with Visual Basic using MS-Word.. and I was having some issues.. jk..

(Update: The issue is no longer a problem for me after I decided not to allow bg color for the text to change until after the sequence of lines had displayed.)

Real Problem:


An assertion is thrown when I change the background color in g2d->Write(...,...,...,bgColor).

Error Msg:

Assertion Failed: *(Cookie Type*)((uint8*)P + nOld) == endCookie
Location:           c:\cs\libs\csutil\ptmalloc_wrap.cpp:434
Message:           Memory block has wrong cookie (probably corrupted by an overflow)


The error occurs only when in the process of writing varying lengths of text consecutively i.e. one line after the other of different lengths of text. Once all of the lines are on screen, there is no issue.

Essentially what I am doing is waiting for a mouse-over on the text and then highlight the text that the mouse is over by changing the background color.

Additionally, further testing yielded that as long as the text color did not include any alpha, the problem did not occur. For example, this works g2d->write(....fgColor, g2d->FindRGB(100, 100, 100, 0));, but this does NOT: g2d->write(....fgColor, g2d->FindRGB(100, 100, 100, 100));

Note: 'Write' is called every frame.
« Last Edit: November 08, 2010, 01:12:09 am by Crystalfur » Logged
CS Developer
Full Member
Posts: 206

View Profile Email
« Reply #1 on: November 08, 2010, 02:58:03 pm »

Look at the callstack to see which memory deallocation causes the message.
Also, I'd guess the background color is _not_ the root cause, it just happens to expose it (by causing different order of memory allocations).
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.211 seconds with 15 queries.