#15559 closed defect (fixed)

GarbageTestCase::LoadGarbage() test_gui unexpected message boxes with wxGTK2/Win32 under Windows XP SP3

Reported by: kosenko Owned by:
Priority: low Milestone:
Component: base Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

I am running test_gui.exe -t Garbage wxDynamicLibrary::Load() method:

wxDynamicLibrary lib;
CPPUNIT_ASSERT( lib.Load(fullname) == false );

In runtime I see system MessageBox'es:

---------------------------
test_gui.exe: test_gui.exe - Bad Image
---------------------------
The application or DLL C:\DOCUME~1\Kolya\LOCALS~1\Temp\gar21.tmp is not a valid Windows image. Please check this against your installation diskette. 
---------------------------
OK   
---------------------------

that appears in inside system ::LoadLibrary() call:

/* static */
wxDllType
wxDynamicLibrary::RawLoad(const wxString& libname, int flags)
{
    if (flags & wxDL_GET_LOADED)
        return ::GetModuleHandle(libname.t_str());

    return ::LoadLibrary(libname.t_str());
}

Tests don't fails, but have probably unrelated GLib warning. When comment out wxDynamicLibrary::Load() call this warning not gone.

Test program for wxWidgets GUI features
build: 3.0 (wchar_t,Visual C++ 1500,wx containers,compatible with 2.8)
running under Windows XP (build 2600, Service Pack 3) as Kolya
  GarbageTestCase::LoadGarbage
(test_gui.exe:3972): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL beforeit's set.
The overwriting error message was: Couldn't load bitmap
  OK    4346 ms

OK (1)

It is weird but wxMSW port works as expected. wxDynamicLibrary class is placed in wxBase, I don't see any wxGTK and wxMSW ports dependent code in dlmsw.cpp and probably caused somehow by GTK+ DLLs or wxGTK specific code somewhere, but I don't know how.
This bug is not caused by r74937 because it appears before.

Attachments (1)

base_seterrormode.diff download (952 bytes) - added by kosenko 10 months ago.

Download all attachments as: .zip

Change History (4)

comment:1 follow-up: Changed 10 months ago by vadz

  • Priority changed from normal to low

Sorry, I can't help with this. I'd expect the first message box to be suppressed by SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX) call in src/msw/app.cpp, but it should be executed for wxGTK too, shouldn't it?

As for the second one, it seems to be unrelated and has probably something to do with GTK+ image loading function failing unexpectedly but I have no idea where exactly nor how to fix it...

comment:2 in reply to: ↑ 1 Changed 10 months ago by kosenko

  • Patch set

Replying to vadz:

Sorry, I can't help with this. I'd expect the first message box to be suppressed by SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX) call in src/msw/app.cpp, but it should be executed for wxGTK too, shouldn't it?


Yes, resolution is similar as in r37488 (#7700).

This bug could appear in non GUI code and I have moved SetErrorMode() call to wxBase app initialization.

Thank you for help with this bug.

Changed 10 months ago by kosenko

comment:3 Changed 10 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [74974]) Call SetErrorMode() for all Windows applications, not just wxMSW ones.

This suppresses default system error message boxes when trying to load an
invalid DLL in wxGTK/Windows.

Closes #15559.

Note: See TracTickets for help on using tickets.