Click here to Skip to main content
15,888,293 members
Home / Discussions / Graphics
   

Graphics

 
QuestionRe: Is it possible to avoid decimation when drawing a bitmap? Pin
Mark Salsbery30-Jul-08 14:44
Mark Salsbery30-Jul-08 14:44 
AnswerRe: Is it possible to avoid decimation when drawing a bitmap? Pin
Jim Warburton31-Jul-08 1:11
Jim Warburton31-Jul-08 1:11 
GeneralRe: Is it possible to avoid decimation when drawing a bitmap? Pin
Mark Salsbery31-Jul-08 7:15
Mark Salsbery31-Jul-08 7:15 
GeneralRe: Is it possible to avoid decimation when drawing a bitmap? Pin
Jim Warburton1-Aug-08 0:03
Jim Warburton1-Aug-08 0:03 
GeneralOpenGL : glGenLists fails (GL_INVALID_OPERATION) (RESOLVED) [modified] Pin
Maximilien29-Jul-08 3:26
Maximilien29-Jul-08 3:26 
QuestionGdiplus::Bitmap destruction crash Pin
Alain Rist28-Jul-08 2:36
Alain Rist28-Jul-08 2:36 
QuestionRe: Gdiplus::Bitmap destruction crash Pin
Mark Salsbery28-Jul-08 7:09
Mark Salsbery28-Jul-08 7:09 
AnswerRe: Gdiplus::Bitmap destruction crash [modified] Pin
Alain Rist28-Jul-08 7:44
Alain Rist28-Jul-08 7:44 
Thanks Mark,

I got the answer with Jim Barry's help.

Mark Salsbery wrote:
Why is drawing code getting called during destruction?


The static Gdiplus::Bitmap bmThumb destructor runs after GdiplusShutdown has been called, resulting in undefined behaviour.

To use this kind of construct I have to GdiplusStartup() and GdiplusShutdown() inside a static object instanciated at the very beginning of app creation, and deleted at the very end for instance:

// main.cpp
#include "stdafx.h"

class GdiPlusUser
{
	ULONG _Token;
public:
	GdiPlusUser() : _Token(0)
	{
		Gdiplus::GdiplusStartupInput input;
		VERIFY(Gdiplus::GdiplusStartup(&_Token, &input, NULL) == Gdiplus::Ok);
	}

	~GdiPlusUser()
	{
		ASSERT(_Token);
		Gdiplus::GdiplusShutdown(_Token);
	}
} _GdiPlusUser;

// anything else
Then no more crash, on XP or Vista.

cheers,
AR

modified on Tuesday, July 29, 2008 12:15 AM

GeneralRe: Gdiplus::Bitmap destruction crash Pin
Mark Salsbery28-Jul-08 7:57
Mark Salsbery28-Jul-08 7:57 
QuestionQuestion Pin
RotaryAce27-Jul-08 13:43
RotaryAce27-Jul-08 13:43 
AnswerRe: Question Pin
Shog927-Jul-08 18:11
sitebuilderShog927-Jul-08 18:11 
AnswerRe: Question Pin
Cedric Moonen27-Jul-08 20:39
Cedric Moonen27-Jul-08 20:39 
AnswerRe: Question Pin
Harvey Saayman27-Jul-08 20:45
Harvey Saayman27-Jul-08 20:45 
QuestionSmart Tee Preview not working properly for MPEG1 Pin
Kuldeep Bhatnagar24-Jul-08 18:56
Kuldeep Bhatnagar24-Jul-08 18:56 
QuestionRe: Smart Tee Preview not working properly for MPEG1 Pin
Mark Salsbery25-Jul-08 6:54
Mark Salsbery25-Jul-08 6:54 
AnswerRe: Smart Tee Preview not working properly for MPEG1 Pin
Kuldeep Bhatnagar28-Jul-08 1:27
Kuldeep Bhatnagar28-Jul-08 1:27 
QuestionRe: Smart Tee Preview not working properly for MPEG1 Pin
Mark Salsbery28-Jul-08 7:13
Mark Salsbery28-Jul-08 7:13 
AnswerRe: Smart Tee Preview not working properly for MPEG1 Pin
Kuldeep Bhatnagar28-Jul-08 23:15
Kuldeep Bhatnagar28-Jul-08 23:15 
GeneralRe: Smart Tee Preview not working properly for MPEG1 Pin
Kuldeep Bhatnagar29-Jul-08 0:58
Kuldeep Bhatnagar29-Jul-08 0:58 
QuestionHELPP please. Pin
chasoknight23-Jul-08 23:34
chasoknight23-Jul-08 23:34 
AnswerRe: HELPP please. Pin
Tim Craig24-Jul-08 14:46
Tim Craig24-Jul-08 14:46 
GeneralRe: HELPP please. Pin
chasoknight24-Jul-08 15:00
chasoknight24-Jul-08 15:00 
GeneralRe: HELPP please. Pin
Tim Craig24-Jul-08 15:31
Tim Craig24-Jul-08 15:31 
AnswerRe: HELPP please. Pin
Mark Salsbery25-Jul-08 6:59
Mark Salsbery25-Jul-08 6:59 
AnswerRe: HELPP please. Pin
Paul Conrad26-Jul-08 18:06
professionalPaul Conrad26-Jul-08 18:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.