Skip to content

gstcefsubprocess.exe spawns a console window per CEF child process on Windows when embedded in a GUI host #108

Description

@Muhomorik

Hit this embedding cefsrc into a .NET Avalonia app on Windows.

Every time the pipeline goes to PLAYING, 4–5 empty black console windows pop up next to my UI -one per CEF child (renderer/GPU/network/utility).

They stick around for the lifetime of the pipeline.

Doesn't happen with gst-launch-1.0 cefsrc url=... because the launcher already owns a console and the children inherit it.
Only shows up when the host is a WINDOWS-subsystem process with no console of its own.

Root cause is one line in CMakeLists.txt (not CMake or c++ expert here):

add_executable(gstcefsubprocess gstcefsubprocess.cc)

No WIN32 keyword -> MSVC defaults to /SUBSYSTEM:CONSOLE -> Windows allocates a console for any console-subsystem child whose parent doesn't already have one.

Can't just add WIN32 because the entry point is int main(...), not WinMain - that'd give linker warnings.

This is the documented MSVC pattern for "GUI subsystem, keep main()".

Something like:

option(GSTCEFSUBPROCESS_WIN32 "Helper subprocess as Windows-subsystem EXE" OFF)
if(WIN32 AND MSVC AND GSTCEFSUBPROCESS_WIN32)
  set_target_properties(gstcefsubprocess PROPERTIES WIN32_EXECUTABLE TRUE)
  target_link_options(gstcefsubprocess PRIVATE "/ENTRY:mainCRTStartup")
endif()

Off by default so CLI users keep stdout.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions