PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

GapiDraw 3.5 Bug - Creating Surface in Symbian Thread

Hi Johan,

I have noticed that this issue has been raised in to previous posts. In both cases no solution was proposed.

Is multithreaded programing with Gapidraw on Symbian possible. Please could you be kind enough to post a little demo as you did here for another platform:

http://www.pocketmatrix.com/forums/view ... ace+thread

Here is what I have tried. In the InitInstance method:

Code:
iProcessPhotos.Create( _L("ProcessPhotos") ,Init, 1024, 1024*1024, 1024*1024*2,this);
iProcessPhotos.Resume();




[code]
TInt CMyApplication::Init(TAny *aPtr)
{
CTrapCleanup* cleanupStack = CTrapCleanup::New();
if (cleanupStack != NULL)
{
CMyApplication *engine = static_cast<CMyApplication*>(aPtr);
CGapiSurface* gsBigThumbnail = new CGapiSurface(engine->m_pGapiDraw);
_TCHAR szPath[MAX_PATH];
_tcscpy(szPath,_T("E:\\Images\\1.bmp"));
HRESULT hr = gsBigThumbnail->CreateSurface(GDSURFACE_CLEAR, szPath);
delete gsBigThumbnail;
delete engine;
}
delete cleanupStack;
cleanupStack = NULL;
return KErrNone;
}

My phone Nokia 6630 resets itself after the CreateSurface method so I can't even get what the return value is. I am using Symbian V7.0. The ErrRd file suprisingly has no error code placed in it either. Please help. Really desperate.

Dynz
I found thatloading an MBM file in a thread works. The problem arises when tring to load BMP files
I have tried creating a surface in a thread using mbm file as follows

void CMyApplication::StartAppThreadFunctionL(TAny* aParam) {
CMyApplication *engine = static_cast<CMyApplication*>(aParam);

_TCHAR szPath[MAX_PATH];
_tcscpy(szPath,_T("E:\\Images\\Library\\1.mbm"));

engine->gsBigThumbnail = new CGapiSurface(engine->m_pGapiDraw);
HRESULT hr = E_FAIL;
hr = engine->gsBigThumbnail->CreateSurface(GDSURFACE_SYSTEMMEMORY, szPath,0); ...
}


When I try to access the engine->gsBigThumbnail in my main process as shown below the program crashes.

hr = pSurface->BltFast(10, 10, gsBigThumbnail, NULL, GDBLTFAST_KEYSRC, NULL);


If I initialise gsBigThumbnail = new CGapiSurface(m_pGapiDraw); in the main process then the line above doesn't crash but returns err GDERR_NOTINITIALIZED. In the thread the CreateSurface returns GD_OK, so I'm assuming it is created fine.

My thread is created as follows:

TInt res = KErrNone;
User::LeaveIfError( res = ProcessPhotos.Create( _L("ProcessPhotos") ,CMyApplication::StartAppThreadFunction, 16384,1024*1024,1024*1024,this)); ProcessPhotos.SetPriority(EPriorityNormal);
ProcessPhotos.Resume();

TInt CMyApplication::StartAppThreadFunction(TAny* aParam) {
CTrapCleanup * cleanup = CTrapCleanup::New();
TInt err;
if( cleanup == NULL )
{
err = KErrNoMemory;
}
else
{
TRAP( err, StartAppThreadFunctionL(aParam) );
}
delete cleanup;
return err;
}

Please advise
none · 13 Sep 2005, 08:10 UTC — ErrRd works this way
The error code does NOT appear in the ErrRd file.
It's normal.
Code should appear on the SCREEN when the application crashes.
(Existence of ErrRd file tells the system to show that!)