![]() |
|
sub bitmaps |
Neil Walker
Member #210
April 2000
![]() |
Hello, When I destroy the sub bitmaps all is well for video and memory bitmaps, but when I call destroy_bitmap on the first sub bitmap where the master is of type System Bitmap, the program crashes. All the pointers are correct as they both display ok and video/memory works fine. My log shows all is well too: New video bitmap is 0x3d9de0 This is the output for video and memory bitmaps, but when I use system bitmaps it crashes on the first destroy. Anyone got a clue as to why? Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
ReyBrujo
Moderator
January 2001
![]() |
Compile with debug support, and use gdb to create a backtrace. Post it here to see if there is an error. -- |
Gideon Weems
Member #3,925
October 2003
|
Onewing
Member #6,152
August 2005
![]() |
This might be of little help. You can use: int is_system_bitmap(BITMAP *bmp); to see if the sub_bitmap is a sub of the system bitmap you've created. I'd be curious as to whether the sub_bitmap was "subbing" correctly. It most likely is. I've had a problem somewhat like this before, but can't remember what it was. When I get home, I'll look to see if I can find the old problem. ------------ |
Evert
Member #794
November 2000
![]() |
Can you post a small sample programme that duplicates the problem? |
Neil Walker
Member #210
April 2000
![]() |
Hello, 2. The parent wasn't destroyed first and the graphics mode hasn't changed. As I said it works ok when it is a video or memory bitmap. 3. Yes, it is a system bitmap, I already checked the output code 4. Well it'll be hard to post a little program as it's part of a very big program Thanks. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
Evert
Member #794
November 2000
![]() |
Quote: 4. Well it'll be hard to post a little program as it's part of a very big program Sure, but you can write a small programme that creates a system bitmap with child and destroys both of those. Does that reproduce the error? If not, start adding things like video bitmaps along with the system bitmaps and see if that makes the error appear, etc... |
ReyBrujo
Moderator
January 2001
![]() |
Do you know how to compile with MinGW? Does your program works with MinGW? It also crash? -- |
Neil Walker
Member #210
April 2000
![]() |
[edit]I've put some outputting to the screen of the image being deleted and I guess I must be doing something wrong as it looks like the image being destroyed is (bizarrely) a different part of the master image. It is doing this for video and system bitmaps but memory ones are ok. I don't really get this as just before I exit I am ouputting the same images and they display ok! I've ran debug from MSVC and it is crashing where I said, at: destroy_bitmap(Image). Checking the value of Image (which is a BITMAP pointer) it seems valid to me and it's address matches that when it was created so it's pointing to the same piece of memory: - Image 0x012f0b20 {w=24 h=24 clip=-1 ...} BITMAP * I've ran a trace on the code and the call stack is roughly what I would expect, is it of any use? alld42.dll!10097efd() Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
ReyBrujo
Moderator
January 2001
![]() |
Wait, are you absolutely sure you are first deleting the subbitmaps before deleting the parent bitmap? As per the documentation: Quote:
BITMAP *create_sub_bitmap(BITMAP *parent, int x, y, width, height); Returns a pointer to the created sub bitmap, or NULL if the sub bitmap
-- |
Evert
Member #794
November 2000
![]() |
Neil: again, have you tried to reproduce the problem with a small example programme? |
Neil Walker
Member #210
April 2000
![]() |
I think it is my code, and it's probably so obvious I haven't spotted it! Anyway here is my quick test code:
Basically Frames is a map containing a vector of FrameItems. Image is a BITMAP* So the loop is simply going through each one and displaying it if it is a sub-bitmap. It displays every graphic ok, so why does it crash on the destroy_bitmap()? Thanks. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
|