[wx-dev] [ wxwindows-Bugs-1925780 ] wxEntryStart tries to "delete"
a static wxLog object
SourceForge.net
noreply at sourceforge.net
Wed Apr 23 19:07:05 PDT 2008
Bugs item #1925780, was opened at 2008-03-26 13:06
Message generated for change (Comment added) made by cazzobuffo
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1925780&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Closed
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Davide Pasca (cazzobuffo)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxEntryStart tries to "delete" a static wxLog object
Initial Comment:
When wxUSE_LOG is defined,
bool wxEntryStart(int& argc, wxChar **argv);
will issue a
delete wxLog::SetActiveTarget(NULL);
but in this case SetActiveTarget() returns a static
wxLog *pOldLogger = ms_pLogger;
ms_pLogger = pLogger;
return pOldLogger;
..and the "delete" will fail.
I noticed the bug by doing a global overload of "new" and "delete".
----------------------------------------------------------------------
>Comment By: Davide Pasca (cazzobuffo)
Date: 2008-04-24 11:07
Message:
Logged In: YES
user_id=1833845
Originator: YES
Setting wxUSE_GLOBAL_MEMORY_OPERATORS to 1 seems to fix the issue.
I wish the library didn't try to do anything out of the ordinary with
"new" and "delete" at the user level ;)
----------------------------------------------------------------------
Comment By: Davide Pasca (cazzobuffo)
Date: 2008-03-27 07:57
Message:
Logged In: YES
user_id=1833845
Originator: YES
I figured that overriding new and delete globally with _aligned_malloc()
and _aligned_free() was a straightforward enough procedure. I certainly
didn't hope for anyone to fix my code 8)
Anyhow, I will look better into the issue as soon as possible.
----------------------------------------------------------------------
Comment By: Vadim Zeitlin (vadz)
Date: 2008-03-27 07:40
Message:
Logged In: YES
user_id=71618
Originator: NO
I'm sorry but you didn't point anything. You basically say that you do
something in your code which doesn't work but you give no indication, not
even a hint, that the problem is due to anything in wx itself. We do need
to have some reason to believe the problem is in wx and, for a report to be
really useful, a simple way to reproduce it. We can't fix bugs in your
code, especially not without seeing it.
----------------------------------------------------------------------
Comment By: Davide Pasca (cazzobuffo)
Date: 2008-03-27 07:37
Message:
Logged In: YES
user_id=1833845
Originator: YES
Status: Closed ?
Sounds like a standing issue to me as overriding new and delete is a
common practice.
Sorry for pointing it anyway. I'll fix it myself.
Thank you for your time 8)
----------------------------------------------------------------------
Comment By: Vadim Zeitlin (vadz)
Date: 2008-03-27 03:27
Message:
Logged In: YES
user_id=71618
Originator: NO
This means that your allocator wasn't used to create the initial log
target for some reason. Without knowing what exactly you do it's impossible
to say what this reason was. But, again, I don't see any bug here.
----------------------------------------------------------------------
Comment By: Davide Pasca (cazzobuffo)
Date: 2008-03-27 01:06
Message:
Logged In: YES
user_id=1833845
Originator: YES
Sorry, for the poor explanation. I can't debug it further right now but I
can say how I got it to happen.
I did override "new" and "delete" to use _aligned_malloc() and
_aligned_free() in Windows.
At the time of the "delete" _aligned_free() will complain that the memory
that has been freed hasn't been allocated with _aligned_malloc().
----------------------------------------------------------------------
Comment By: Vadim Zeitlin (vadz)
Date: 2008-03-26 23:24
Message:
Logged In: YES
user_id=71618
Originator: NO
Sorry, I don't understand what the problem is. Granted, ms_pLogger is a
static but it's a static pointer and the pointer itself is still allocated
on the heap so what's the problem with deleting it?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1925780&group_id=9863
More information about the wx-dev
mailing list