Skip to content

Commit

Permalink
feat: fix macOS runtime error due to early initialisation for CefString
Browse files Browse the repository at this point in the history
  • Loading branch information
tishion committed Oct 30, 2024
1 parent 4ca01b2 commit bdc9f9e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmake/CefViewCoreConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(FetchContent)
FetchContent_Declare(
CefViewCore
GIT_REPOSITORY https://github.com/CefView/CefViewCore.git
GIT_TAG 1cc9a2a1085520bc31609c623ae338e699498bb7
GIT_TAG 0aa55c8ae761f7b62286ef8ca68db33e6328c41c
)

# set CEF version to be used
Expand Down
7 changes: 6 additions & 1 deletion include/QCefView.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
* File: QCefView.h
* Project: QCefView
* Created: 29th March 2016
Expand Down Expand Up @@ -57,6 +57,11 @@ class QCEFVIEW_EXPORT QCefView : public QWidget
/// The main frame identity
/// </summary>
static const QCefFrameId MainFrameID;

/// <summary>
/// The identifier for all frames
/// </summary>
static const QCefFrameId AllFrameID;

/// <summary>
/// Represents the CEF pop-up windows open disposition
Expand Down
2 changes: 1 addition & 1 deletion include/QCefView_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#pragma region qt_headers
#include <QtCore/qglobal.h>
#include <QMetaType>
#pragma endregion qt_headers
#pragma endregion

#ifdef QCEFVIEW_STATIC
// Static library, no need export
Expand Down
8 changes: 5 additions & 3 deletions src/QCefView.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <QCefView.h>
#include <QCefView.h>

#pragma region qt_headers
#include <QPainter>
Expand All @@ -16,8 +16,10 @@

#if CEF_VERSION_MAJOR < 122
const QCefFrameId QCefView::MainFrameID = 0;
const QCefFrameId QCefView::AllFrameID = -1;
#else
const QCefFrameId QCefView::MainFrameID = "0";
const QCefFrameId QCefView::AllFrameID = "-1";
#endif

QCefView::QCefView(const QString& url,
Expand Down Expand Up @@ -166,7 +168,7 @@ QCefView::triggerEvent(const QCefEvent& event)
Q_D(QCefView);

return d->triggerEvent(
event.eventName(), event.d_func()->args, ValueConvertor::FrameIdC2Q(CefViewBrowserClient::MAIN_FRAME));
event.eventName(), event.d_func()->args, QCefView::MainFrameID);
}

bool
Expand All @@ -183,7 +185,7 @@ QCefView::broadcastEvent(const QCefEvent& event)
Q_D(QCefView);

return d->triggerEvent(
event.eventName(), event.d_func()->args, ValueConvertor::FrameIdC2Q(CefViewBrowserClient::ALL_FRAMES));
event.eventName(), event.d_func()->args, QCefView::AllFrameID);
}

bool
Expand Down
4 changes: 2 additions & 2 deletions src/details/QCefViewPrivate.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "QCefViewPrivate.h"
#include "QCefViewPrivate.h"

#pragma region stl_headers
#include <stdexcept>
Expand Down Expand Up @@ -1217,7 +1217,7 @@ QCefViewPrivate::browserStopLoad()
bool
QCefViewPrivate::triggerEvent(const QString& name,
const QVariantList& args,
const QCefFrameId& frameId /*= CefViewBrowserHandler::MAIN_FRAME*/)
const QCefFrameId& frameId /*= QCefView::MainFrameID*/)
{
if (!name.isEmpty()) {
return sendEventNotifyMessage(frameId, name, args);
Expand Down
4 changes: 2 additions & 2 deletions src/details/QCefViewPrivate.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once
#pragma once
#pragma region qt_headers
#include <QMenu>
#include <QMutex>
Expand Down Expand Up @@ -315,7 +315,7 @@ public slots:

bool triggerEvent(const QString& name,
const QVariantList& args,
const QCefFrameId& frameId = ValueConvertor::FrameIdC2Q(CefViewBrowserClient::MAIN_FRAME));
const QCefFrameId& frameId = QCefView::MainFrameID);

bool responseQCefQuery(const QCefQuery& query);

Expand Down

0 comments on commit bdc9f9e

Please sign in to comment.